ruby-changes:37090
From: nobu <ko1@a...>
Date: Wed, 7 Jan 2015 19:30:02 +0900 (JST)
Subject: [ruby-changes:37090] nobu:r49171 (trunk): dir.c: use macros
nobu 2015-01-07 19:29:49 +0900 (Wed, 07 Jan 2015) New Revision: 49171 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49171 Log: dir.c: use macros * dir.c (replace_real_basename): use macros for getattrlist buffer. Modified files: trunk/dir.c Index: dir.c =================================================================== --- dir.c (revision 49170) +++ dir.c (revision 49171) @@ -81,7 +81,6 @@ char *strchr(char*,char); https://github.com/ruby/ruby/blob/trunk/dir.c#L81 # define USE_NAME_ON_FS 1 # define RUP32(size) ((size)+3/4) # define SIZEUP32(type) RUP32(sizeof(type)) -# define NEXT(var) var = (void *)((ptr += SIZEUP32(var)) - SIZEUP32(var)) #else # define USE_NAME_ON_FS 0 #endif @@ -91,6 +90,7 @@ char *strchr(char*,char); https://github.com/ruby/ruby/blob/trunk/dir.c#L90 #else # define NORMALIZE_UTF8PATH 0 #endif + #if NORMALIZE_UTF8PATH #include <sys/param.h> #include <sys/mount.h> @@ -1354,7 +1354,7 @@ join_path(const char *path, long len, in https://github.com/ruby/ruby/blob/trunk/dir.c#L1354 static char * replace_real_basename(char *path, long base, int norm_p) { - u_int32_t attrbuf[(sizeof(attrreference_t) + MAXPATHLEN * 3 + sizeof(u_int32_t) - 1) / sizeof(u_int32_t) + 1]; + u_int32_t attrbuf[SIZEUP32(attrreference_t) + RUP32(MAXPATHLEN * 3) + 1]; struct attrlist al = {ATTR_BIT_MAP_COUNT, 0, ATTR_CMN_NAME}; const attrreference_t *ar = (void *)(attrbuf+1); const char *name; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/