Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/fs/hfs simplify and avoid pointer gymnastics



details:   https://anonhg.NetBSD.org/src/rev/ed2a7c419f9f
branches:  trunk
changeset: 762650:ed2a7c419f9f
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Feb 24 23:49:26 2011 +0000

description:
simplify and avoid pointer gymnastics

diffstat:

 sys/fs/hfs/libhfs.c |  13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diffs (36 lines):

diff -r cc9c703dd49a -r ed2a7c419f9f sys/fs/hfs/libhfs.c
--- a/sys/fs/hfs/libhfs.c       Thu Feb 24 23:48:59 2011 +0000
+++ b/sys/fs/hfs/libhfs.c       Thu Feb 24 23:49:26 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: libhfs.c,v 1.9 2009/11/27 15:58:39 pooka Exp $ */
+/*     $NetBSD: libhfs.c,v 1.10 2011/02/24 23:49:26 christos Exp $     */
 
 /*-
  * Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: libhfs.c,v 1.9 2009/11/27 15:58:39 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: libhfs.c,v 1.10 2011/02/24 23:49:26 christos Exp $");
 
 #include "libhfs.h"
 
@@ -460,14 +460,11 @@
                goto exit;
        
        /* copy only the bytes that are actually used */
-       memcpy(*out_unicode+2, path + path_offset, total_path_length*2);
+       memcpy(*out_unicode + 2, path + path_offset, total_path_length*2);
 
        /* insert forward slash at start */
-       (*out_unicode)[0] = 0x00;
-       (*out_unicode)[1] = 0x2F;
-       ptr = (uint16_t*)*out_unicode;
-       uchar = be16tohp((void*)&ptr);
-       *(ptr-1) = uchar;
+       uchar = be16toh(0x2F);
+       memcpy(*out_unicode, &uchar, sizeof(uchar));
 
        /* insert null char at end */
        (*out_unicode)[total_path_length*2+2] = 0x00;



Home | Main Index | Thread Index | Old Index