[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[1957] 2009-01-26 Daniel Mierswa <address@hidden>
From: |
Pavel Roskin |
Subject: |
[1957] 2009-01-26 Daniel Mierswa <address@hidden> |
Date: |
Mon, 26 Jan 2009 04:22:45 +0000 |
Revision: 1957
http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=1957
Author: proski
Date: 2009-01-26 04:22:44 +0000 (Mon, 26 Jan 2009)
Log Message:
-----------
2009-01-26 Daniel Mierswa <address@hidden>
* kern/misc.c (grub_strcasecmp): New function.
(grub_strcasecmp): Use grub_size_t instead of int for length.
Fix return value.
* include/grub/misc.h: Update function prototypes.
Modified Paths:
--------------
trunk/grub2/ChangeLog
trunk/grub2/include/grub/misc.h
trunk/grub2/kern/misc.c
Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog 2009-01-26 04:05:54 UTC (rev 1956)
+++ trunk/grub2/ChangeLog 2009-01-26 04:22:44 UTC (rev 1957)
@@ -1,3 +1,10 @@
+2009-01-26 Daniel Mierswa <address@hidden>
+
+ * kern/misc.c (grub_strcasecmp): New function.
+ (grub_strcasecmp): Use grub_size_t instead of int for length.
+ Fix return value.
+ * include/grub/misc.h: Update function prototypes.
+
2009-01-26 Robert Millan <address@hidden>
* configure.ac: Fix cross-compilation check.
Modified: trunk/grub2/include/grub/misc.h
===================================================================
--- trunk/grub2/include/grub/misc.h 2009-01-26 04:05:54 UTC (rev 1956)
+++ trunk/grub2/include/grub/misc.h 2009-01-26 04:22:44 UTC (rev 1957)
@@ -45,7 +45,8 @@
int EXPORT_FUNC(grub_memcmp) (const void *s1, const void *s2, grub_size_t n);
int EXPORT_FUNC(grub_strcmp) (const char *s1, const char *s2);
int EXPORT_FUNC(grub_strncmp) (const char *s1, const char *s2, grub_size_t n);
-int EXPORT_FUNC(grub_strncasecmp) (const char *s1, const char *s2, int c);
+int EXPORT_FUNC(grub_strcasecmp) (const char *s1, const char *s2);
+int EXPORT_FUNC(grub_strncasecmp) (const char *s1, const char *s2, grub_size_t
n);
char *EXPORT_FUNC(grub_strchr) (const char *s, int c);
char *EXPORT_FUNC(grub_strrchr) (const char *s, int c);
int EXPORT_FUNC(grub_strword) (const char *s, const char *w);
Modified: trunk/grub2/kern/misc.c
===================================================================
--- trunk/grub2/kern/misc.c 2009-01-26 04:05:54 UTC (rev 1956)
+++ trunk/grub2/kern/misc.c 2009-01-26 04:22:44 UTC (rev 1957)
@@ -194,7 +194,7 @@
while (*s1 && *s2)
{
if (*s1 != *s2)
- return (int) *s1 - (int) *s2;
+ break;
s1++;
s2++;
@@ -212,7 +212,7 @@
while (*s1 && *s2 && --n)
{
if (*s1 != *s2)
- return (int) *s1 - (int) *s2;
+ break;
s1++;
s2++;
@@ -222,21 +222,36 @@
}
int
-grub_strncasecmp (const char *s1, const char *s2, int c)
+grub_strcasecmp (const char *s1, const char *s2)
{
- int p = 1;
+ while (*s1 && *s2)
+ {
+ if (grub_tolower (*s1) != grub_tolower (*s2))
+ break;
- while (grub_tolower (*s1) && grub_tolower (*s2) && p < c)
+ s1++;
+ s2++;
+ }
+
+ return (int) grub_tolower (*s1) - (int) grub_tolower (*s2);
+}
+
+int
+grub_strncasecmp (const char *s1, const char *s2, grub_size_t n)
+{
+ if (n == 0)
+ return 0;
+
+ while (*s1 && *s2 && --n)
{
if (grub_tolower (*s1) != grub_tolower (*s2))
- return (int) grub_tolower (*s1) - (int) grub_tolower (*s2);
+ break;
s1++;
s2++;
- p++;
}
- return (int) *s1 - (int) *s2;
+ return (int) grub_tolower (*s1) - (int) grub_tolower (*s2);
}
char *
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [1957] 2009-01-26 Daniel Mierswa <address@hidden>,
Pavel Roskin <=