Mercurial > hg > xemacs-beta
diff src/sysdep.c @ 462:0784d089fdc9 r21-2-46
Import from CVS: tag r21-2-46
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:44:37 +0200 |
parents | 223736d75acb |
children | 7039e6323819 |
line wrap: on
line diff
--- a/src/sysdep.c Mon Aug 13 11:43:25 2007 +0200 +++ b/src/sysdep.c Mon Aug 13 11:44:37 2007 +0200 @@ -33,7 +33,7 @@ #ifdef WIN32_NATIVE #ifdef MINGW -#include <mingw32/process.h> +#include <mingw/process.h> #else /* <process.h> should not conflict with "process.h", as per ANSI definition. This is not true with visual c though. The trick below works with @@ -2985,23 +2985,22 @@ if (rtnval == NULL) /* End of directory */ return NULL; { - Extcount external_len; - int ascii_filename_p = 1; const Extbyte * const external_name = (const Extbyte *) rtnval->d_name; - - /* Optimize for the common all-ASCII case, computing len en passant */ - for (external_len = 0; external_name[external_len] ; external_len++) - { - if (!BYTE_ASCII_P (external_name[external_len])) - ascii_filename_p = 0; - } - if (ascii_filename_p) + Extcount external_len = strlen (rtnval->d_name); + const Bufbyte *internal_name; + Bytecount internal_len; + + TO_INTERNAL_FORMAT (DATA, (external_name, external_len), + ALLOCA, (internal_name, internal_len), + Qfile_name); + + /* check for common case of ASCII filename */ + if (internal_len == external_len && + !memcmp (external_name, internal_name, internal_len)) return rtnval; { /* Non-ASCII filename */ static Bufbyte_dynarr *internal_DIRENTRY; - const Bufbyte *internal_name; - Bytecount internal_len; if (!internal_DIRENTRY) internal_DIRENTRY = Dynarr_new (Bufbyte); else @@ -3010,9 +3009,6 @@ Dynarr_add_many (internal_DIRENTRY, (Bufbyte *) rtnval, offsetof (DIRENTRY, d_name)); - TO_INTERNAL_FORMAT (DATA, (external_name, external_len), - ALLOCA, (internal_name, internal_len), - Qfile_name); Dynarr_add_many (internal_DIRENTRY, internal_name, internal_len); Dynarr_add (internal_DIRENTRY, '\0'); /* NUL-terminate */