Module Name:    src
Committed By:   christos
Date:           Thu Feb 24 23:49:26 UTC 2011

Modified Files:
        src/sys/fs/hfs: libhfs.c

Log Message:
simplify and avoid pointer gymnastics


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/fs/hfs/libhfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/hfs/libhfs.c
diff -u src/sys/fs/hfs/libhfs.c:1.9 src/sys/fs/hfs/libhfs.c:1.10
--- src/sys/fs/hfs/libhfs.c:1.9	Fri Nov 27 10:58:39 2009
+++ src/sys/fs/hfs/libhfs.c	Thu Feb 24 18:49:26 2011
@@ -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;

Reply via email to