summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1997-10-14 22:25:02 +0000
committerJim Meyering <jim@meyering.net>1997-10-14 22:25:02 +0000
commit2bb1be5ca00c62fd5eeb050e906192b4f42e2055 (patch)
tree525c1e525b61a35a7fe40763dce4eeceef815e9b /src
parentcb3a4594b9932e3318f7a7463e6ad77c4c836e7d (diff)
downloadcoreutils-2bb1be5ca00c62fd5eeb050e906192b4f42e2055.tar.gz
coreutils-2bb1be5ca00c62fd5eeb050e906192b4f42e2055.zip
(NLS_STRCMP): Define.
(getmonth): Remove ifdef and use NLS_STRCMP instead. Use HAVE_ALLOCA, not _HAVE_ALLOCA.
Diffstat (limited to 'src')
-rw-r--r--src/sort.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/sort.c b/src/sort.c
index 133d8886b..a8a74419b 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -87,8 +87,10 @@ char *xstrdup ();
#ifdef ENABLE_NLS
# define NLS_MEMCMP(S1, S2, Len) strncoll (S1, S2, Len)
+# define NLS_STRCMP(S1, S2) strcoll (S1, S2)
#else
# define NLS_MEMCMP(S1, S2, Len) memcmp (S1, S2, Len)
+# define NLS_STRCMP(S1, S2) strcmp (S1, S2)
#endif
#ifdef ENABLE_NLS
@@ -1487,7 +1489,7 @@ getmonth (const char *s, int len)
if (len == 0)
return 0;
-#ifdef _HAVE_ALLOCA
+#ifdef HAVE_ALLOCA
month = (char *) alloca (len + 1);
#else
month = (char *) malloc (len + 1);
@@ -1501,18 +1503,14 @@ getmonth (const char *s, int len)
while (hi - lo > 1)
{
-#ifdef ENABLE_NLS
- if (strcoll (month, monthtab[(lo + hi) / 2].name) < 0)
-#else
- if (strcmp (month, monthtab[(lo + hi) / 2].name) < 0)
-#endif
+ if (NLS_STRCMP (month, monthtab[(lo + hi) / 2].name) < 0)
hi = (lo + hi) / 2;
else
lo = (lo + hi) / 2;
}
result = !strcmp (month, monthtab[lo].name) ? monthtab[lo].val : 0;
-#ifndef _HAVE_ALLOCA
+#ifndef HAVE_ALLOCA
free (month);
#endif