summaryrefslogtreecommitdiff
path: root/rpmio
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-03-18 08:55:05 +0200
committerPanu Matilainen <pmatilai@redhat.com>2008-03-18 08:55:05 +0200
commit9df54a8622b6640e54288835e62c6c0d0b23c748 (patch)
tree64d42a38ee6df118cd2dd41a3a93b076d9cea38f /rpmio
parent5cde7cac9619c90a83d2f63f9d3760d0a352226e (diff)
downloadrpm-9df54a8622b6640e54288835e62c6c0d0b23c748.tar.gz
rpm-9df54a8622b6640e54288835e62c6c0d0b23c748.tar.bz2
rpm-9df54a8622b6640e54288835e62c6c0d0b23c748.zip
More xstr[n]casecmp to rpmstring along the other string-stuff...
Diffstat (limited to 'rpmio')
-rw-r--r--rpmio/Makefile.am2
-rw-r--r--rpmio/rpmstring.c41
-rw-r--r--rpmio/strcasecmp.c48
3 files changed, 42 insertions, 49 deletions
diff --git a/rpmio/Makefile.am b/rpmio/Makefile.am
index cda6457b6..00abee5a8 100644
--- a/rpmio/Makefile.am
+++ b/rpmio/Makefile.am
@@ -14,7 +14,7 @@ usrlib_LTLIBRARIES = librpmio.la
librpmio_la_SOURCES = \
argv.c base64.h base64.c digest.h digest.c fts.c macro.c \
rpmhook.c rpmio.c rpmlog.c rpmlua.c rpmmalloc.c \
- rpmpgp.c rpmsq.c rpmsw.c strcasecmp.c url.c ugid.c \
+ rpmpgp.c rpmsq.c rpmsw.c url.c ugid.c \
rpmio_internal.h rpmlua.h rpmhook.h ugid.h fts.h \
rpmstring.c rpmfileutil.c
diff --git a/rpmio/rpmstring.c b/rpmio/rpmstring.c
index 64df1f918..405a8e255 100644
--- a/rpmio/rpmstring.c
+++ b/rpmio/rpmstring.c
@@ -135,3 +135,44 @@ void appendStringBufAux(StringBuf sb, const char *s, int nl)
sb->free--;
}
}
+
+int xstrcasecmp(const char * s1, const char * s2)
+{
+ const char * p1 = s1;
+ const char * p2 = s2;
+ char c1, c2;
+
+ if (p1 == p2)
+ return 0;
+
+ do
+ {
+ c1 = xtolower (*p1++);
+ c2 = xtolower (*p2++);
+ if (c1 == '\0')
+ break;
+ }
+ while (c1 == c2);
+
+ return (int)(c1 - c2);
+}
+
+int xstrncasecmp(const char *s1, const char *s2, size_t n)
+{
+ const char * p1 = s1;
+ const char * p2 = s2;
+ char c1, c2;
+
+ if (p1 == p2 || n == 0)
+ return 0;
+
+ do
+ {
+ c1 = xtolower (*p1++);
+ c2 = xtolower (*p2++);
+ if (c1 == '\0' || c1 != c2)
+ break;
+ } while (--n > 0);
+
+ return (int)(c1 - c2);
+}
diff --git a/rpmio/strcasecmp.c b/rpmio/strcasecmp.c
deleted file mode 100644
index 79f030a10..000000000
--- a/rpmio/strcasecmp.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/** \ingroup rpmio
- * \file rpmio/strcasecmp.c
- */
-
-#include "system.h"
-#include <rpm/rpmstring.h>
-#include "debug.h"
-
-int xstrcasecmp(const char * s1, const char * s2)
-{
- const char * p1 = s1;
- const char * p2 = s2;
- char c1, c2;
-
- if (p1 == p2)
- return 0;
-
- do
- {
- c1 = xtolower (*p1++);
- c2 = xtolower (*p2++);
- if (c1 == '\0')
- break;
- }
- while (c1 == c2);
-
- return (int)(c1 - c2);
-}
-
-int xstrncasecmp(const char *s1, const char *s2, size_t n)
-{
- const char * p1 = s1;
- const char * p2 = s2;
- char c1, c2;
-
- if (p1 == p2 || n == 0)
- return 0;
-
- do
- {
- c1 = xtolower (*p1++);
- c2 = xtolower (*p2++);
- if (c1 == '\0' || c1 != c2)
- break;
- } while (--n > 0);
-
- return (int)(c1 - c2);
-}