* dir.c (range): use NULL instead of 0.

* dir.c (range): get rid of a gcc 3.4 warning.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
knu 2004-07-17 18:24:15 +00:00
parent 5d7d86d936
commit a91e86dd1f
2 changed files with 12 additions and 6 deletions

View file

@ -1,3 +1,9 @@
Sun Jul 18 03:21:42 2004 Akinori MUSHA <knu@iDaemons.org>
* dir.c (range): use NULL instead of 0.
* dir.c (range): get rid of a gcc 3.4 warning.
Sun Jul 18 03:12:11 2004 Shugo Maeda <shugo@ruby-lang.org> Sun Jul 18 03:12:11 2004 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/imap.rb (receive_responses): return if a LOGOUT response * lib/net/imap.rb (receive_responses): return if a LOGOUT response

12
dir.c
View file

@ -93,8 +93,8 @@ char *strchr _((char*,char));
static char * static char *
range(pat, test, flags) range(pat, test, flags)
char *pat; const char *pat;
char test; int test;
int flags; int flags;
{ {
int not, ok = 0; int not, ok = 0;
@ -113,19 +113,19 @@ range(pat, test, flags)
pat++; pat++;
cstart = cend = *pat++; cstart = cend = *pat++;
if (!cstart) if (!cstart)
return 0; return NULL;
if (*pat == '-' && pat[1] != ']') { if (*pat == '-' && pat[1] != ']') {
pat++; pat++;
if (escape && *pat == '\\') if (escape && *pat == '\\')
pat++; pat++;
cend = *pat++; cend = *pat++;
if (!cend) if (!cend)
return 0; return NULL;
} }
if (downcase(cstart) <= test && test <= downcase(cend)) if (downcase(cstart) <= test && test <= downcase(cend))
ok = 1; ok = 1;
} }
return ok == not ? 0 : pat + 1; return ok == not ? NULL : (char *)pat + 1;
} }
#define ISDIRSEP(c) (pathname && isdirsep(c)) #define ISDIRSEP(c) (pathname && isdirsep(c))
@ -191,7 +191,7 @@ fnmatch(pat, string, flags)
if (!*s || ISDIRSEP(*s) || PERIOD(s)) if (!*s || ISDIRSEP(*s) || PERIOD(s))
return FNM_NOMATCH; return FNM_NOMATCH;
pat = range(pat, *s, flags); pat = range(pat, *s, flags);
if (!pat) if (pat == NULL)
return FNM_NOMATCH; return FNM_NOMATCH;
s++; s++;
break; break;