projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(STRXCASECMP_FUNCTION): Don't increment within macro argument list.
[gnulib.git]
/
lib
/
strverscmp.c
diff --git
a/lib/strverscmp.c
b/lib/strverscmp.c
index
defef43
..
1e87461
100644
(file)
--- a/
lib/strverscmp.c
+++ b/
lib/strverscmp.c
@@
-18,6
+18,10
@@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include <string.h>
#include <ctype.h>
#include <string.h>
#include <ctype.h>
@@
-39,9
+43,7
@@
*/
int
*/
int
-strverscmp (s1, s2)
- const char *s1;
- const char *s2;
+strverscmp (const char *s1, const char *s2)
{
const unsigned char *p1 = (const unsigned char *) s1;
const unsigned char *p2 = (const unsigned char *) s2;
{
const unsigned char *p1 = (const unsigned char *) s1;
const unsigned char *p2 = (const unsigned char *) s2;
@@
-67,11
+69,11
@@
strverscmp (s1, s2)
/* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
/* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
- /* S_I */ CMP, -1, -1, CMP,
+
1, LEN, LEN, CMP,
-
+
1, LEN, LEN, CMP, CMP, CMP, CMP, CMP,
+ /* S_I */ CMP, -1, -1, CMP,
1, LEN, LEN, CMP,
+
1, LEN, LEN, CMP, CMP, CMP, CMP, CMP,
/* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
/* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
- /* S_Z */ CMP,
+1, +
1, CMP, -1, CMP, CMP, CMP,
+ /* S_Z */ CMP,
1,
1, CMP, -1, CMP, CMP, CMP,
-1, CMP, CMP, CMP
};
-1, CMP, CMP, CMP
};
@@
-81,7
+83,7
@@
strverscmp (s1, s2)
c1 = *p1++;
c2 = *p2++;
/* Hint: '0' is a digit too. */
c1 = *p1++;
c2 = *p2++;
/* Hint: '0' is a digit too. */
- state = S_N | (
c1 == '0') + (isdigit (c1) != 0
);
+ state = S_N | (
(c1 == '0') + (isdigit (c1) != 0)
);
while ((diff = c1 - c2) == 0 && c1 != '\0')
{
while ((diff = c1 - c2) == 0 && c1 != '\0')
{
@@
-94,7
+96,7
@@
strverscmp (s1, s2)
state = result_type[state << 2 | ((c2 == '0') + (isdigit (c2) != 0))];
switch (state)
state = result_type[state << 2 | ((c2 == '0') + (isdigit (c2) != 0))];
switch (state)
- {
+
{
case CMP:
return diff;
case CMP:
return diff;
@@
-107,5
+109,5
@@
strverscmp (s1, s2)
default:
return state;
default:
return state;
- }
+
}
}
}