Revision: 14443 Author: adrian.chadd Date: Wed Mar 3 05:14:59 2010 Log: Break out some string routines into a new string util file.
http://code.google.com/p/lusca-cache/source/detail?r=14443 Added: /branches/LUSCA_HEAD/libcore/strutil.c /branches/LUSCA_HEAD/libcore/strutil.h Modified: /branches/LUSCA_HEAD/libcore/Makefile.am /branches/LUSCA_HEAD/src/store.c ======================================= --- /dev/null +++ /branches/LUSCA_HEAD/libcore/strutil.c Wed Mar 3 05:14:59 2010 @@ -0,0 +1,21 @@ +#include <stdio.h> +#include <string.h> + +int +strmatchbeg(const char *search, const char *match, int maxlen) +{ + int mlen = strlen(match); + if (maxlen < mlen) + return -1; + return strncmp(search, match, mlen); +} + +int +strmatch(const char *search, const char *match, int maxlen) +{ + int mlen = strlen(match); + if (maxlen < mlen) + return -1; + return strncmp(search, match, maxlen); +} + ======================================= --- /dev/null +++ /branches/LUSCA_HEAD/libcore/strutil.h Wed Mar 3 05:14:59 2010 @@ -0,0 +1,7 @@ +#ifndef __LIBCORE_STRUTIL_H__ +#define __LIBCORE_STRUTIL_H__ + +extern int strmatchbeg(const char *search, const char *match, int maxlen); +extern int strmatch(const char *search, const char *match, int maxlen); + +#endif ======================================= --- /branches/LUSCA_HEAD/libcore/Makefile.am Fri Mar 27 14:31:13 2009 +++ /branches/LUSCA_HEAD/libcore/Makefile.am Wed Mar 3 05:14:59 2010 @@ -7,7 +7,8 @@ tools.c \ fifo.c \ kb.c \ - radix.c + radix.c \ + strutil.c noinst_LIBRARIES = \ libcore.a ======================================= --- /branches/LUSCA_HEAD/src/store.c Sat Feb 13 23:34:59 2010 +++ /branches/LUSCA_HEAD/src/store.c Wed Mar 3 05:14:59 2010 @@ -34,8 +34,11 @@ */ #include "squid.h" +#include "../libcore/strutil.h" + #include "store_vary.h" + #define REBUILD_TIMESTAMP_DELTA_MAX 2 #define STORE_IN_MEM_BUCKETS (229) @@ -487,24 +490,6 @@ EBIT_SET(e->flags, KEY_PRIVATE); storeHashInsert(e, newkey); } - -static int inline -strmatchbeg(const char *search, const char *match, int maxlen) -{ - int mlen = strlen(match); - if (maxlen < mlen) - return -1; - return strncmp(search, match, mlen); -} - -static int inline -strmatch(const char *search, const char *match, int maxlen) -{ - int mlen = strlen(match); - if (maxlen < mlen) - return -1; - return strncmp(search, match, maxlen); -} void storeSetPublicKey(StoreEntry * e) -- You received this message because you are subscribed to the Google Groups "lusca-commit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/lusca-commit?hl=en.
