move strndiff and strdiff to node.c and make it private

This commit is contained in:
c9s 2014-05-20 23:25:12 +08:00
parent 26c7e8896e
commit 99819c4bbb
4 changed files with 21 additions and 25 deletions

View file

@ -10,10 +10,6 @@
#include "r3_define.h"
#include "config.h"
int strndiff(char * d1, char * d2, unsigned int n);
int strdiff(char * d1, char * d2);
int slug_count(char * p, int len);
char * compile_slug(char * str, int len);

View file

@ -18,9 +18,28 @@
#include "r3.h"
#include "str_array.h"
// String value as the index http://judy.sourceforge.net/doc/JudySL_3x.htm
static int strndiff(char * d1, char * d2, unsigned int n) {
char * o = d1;
while ( *d1 == *d2 && n-- > 0 ) {
d1++;
d2++;
}
return d1 - o;
}
static int strdiff(char * d1, char * d2) {
char * o = d1;
while( *d1 == *d2 ) {
d1++;
d2++;
}
return d1 - o;
}
/**
* Create a node object
*/

View file

@ -12,26 +12,6 @@
#include "str_array.h"
#include "r3_define.h"
int strndiff(char * d1, char * d2, unsigned int n) {
char * o = d1;
while ( *d1 == *d2 && n-- > 0 ) {
d1++;
d2++;
}
return d1 - o;
}
int strdiff(char * d1, char * d2) {
char * o = d1;
while( *d1 == *d2 ) {
d1++;
d2++;
}
return d1 - o;
}
/**
* provide a quick way to count slugs, simply search for '{'
*/

View file

@ -384,3 +384,4 @@
1400593197,13978543.79
1400593210,13568445.16
1400593219,13704926.07
1400599508,13991454.07

1 1400242718 5649455.80
384 1400593197 13978543.79
385 1400593210 13568445.16
386 1400593219 13704926.07
387 1400599508 13991454.07