# HG changeset patch # User Mahlon E. Smith # Date 1494998901 25200 # Node ID eedb2586dea4177de27815c21c364ee97023b08b # Parent d1b9dd767e3adc7f5a2423580bc3b36843b09195 Tag C functions as static to avoid name collisions. (Thanks Michael.) diff -r d1b9dd767e3a -r eedb2586dea4 ext/ezmlm/hash/hash.c --- a/ext/ezmlm/hash/hash.c Tue May 16 16:03:03 2017 -0700 +++ b/ext/ezmlm/hash/hash.c Tue May 16 22:28:21 2017 -0700 @@ -13,6 +13,7 @@ * */ +static void surf(unsigned int out[8],const unsigned int in[12],const unsigned int seed[32]) { unsigned int t[12]; unsigned int x; unsigned int sum = 0; @@ -32,6 +33,7 @@ } } +static void surfpcs_init(surfpcs *s,const unsigned int k[32]) { int i; @@ -41,6 +43,7 @@ s->todo = 0; } +static void surfpcs_add(surfpcs *s,const char *x,unsigned int n) { int i; @@ -59,6 +62,7 @@ } } +static void surfpcs_addlc(surfpcs *s,const char *x,unsigned int n) /* modified from surfpcs_add by case-independence and skipping ' ' & '\t' */ { @@ -84,6 +88,7 @@ } } +static void surfpcs_out(surfpcs *s,unsigned char h[32]) { int i; @@ -95,6 +100,7 @@ for (i = 0;i < 32;++i) h[i] = outdata[end[i]]; } +static void makehash(const char *indata,unsigned int inlen,char *hash) /* makes hash[COOKIE=20] from stralloc *indata, ignoring case and */ /* SPACE/TAB */ @@ -112,6 +118,7 @@ hash[i] = 'a' + (h[i] & 15); } +static unsigned int subhashb(const char *s,long len) { unsigned long h; @@ -121,6 +128,7 @@ return h % 53; } +static unsigned int subhashs(const char *s) { return subhashb(s,strlen(s)); @@ -132,7 +140,7 @@ /* - * call­seq: + * call-seq: * Ezmlm::Hash.address( email ) -> String * * Call the Surf hashing function on an +email+ address, returning @@ -141,7 +149,7 @@ * the '<' character.) * */ -VALUE +static VALUE address( VALUE klass, VALUE email ) { char hash[20]; char *input; @@ -158,14 +166,14 @@ /* - * call­seq: + * call-seq: * Ezmlm::Hash.subscriber( address ) -> String * * Call the subscriber hashing function on an email +address+, returning * the index character referring to the file containing subscriber presence. * */ -VALUE +static VALUE subscriber( VALUE klass, VALUE email ) { unsigned int prefix; diff -r d1b9dd767e3a -r eedb2586dea4 ext/ezmlm/hash/hash.h --- a/ext/ezmlm/hash/hash.h Tue May 16 16:03:03 2017 -0700 +++ b/ext/ezmlm/hash/hash.h Tue May 16 22:28:21 2017 -0700 @@ -27,19 +27,19 @@ #define data ((unsigned char *) s->in) #define outdata ((unsigned char *) s->out) -extern void surf( unsigned int out[8], const unsigned int in[12], const unsigned int seed[32] ); -extern void surfpcs_init( surfpcs *s, const unsigned int k[32] ); -extern void surfpcs_add( surfpcs *s, const char *x,unsigned int n ); -extern void surfpcs_addlc( surfpcs *s, const char *x,unsigned int n ); -extern void surfpcs_out( surfpcs *s, unsigned char h[32] ); +static void surf( unsigned int out[8], const unsigned int in[12], const unsigned int seed[32] ); +static void surfpcs_init( surfpcs *s, const unsigned int k[32] ); +static void surfpcs_add( surfpcs *s, const char *x,unsigned int n ); +static void surfpcs_addlc( surfpcs *s, const char *x,unsigned int n ); +static void surfpcs_out( surfpcs *s, unsigned char h[32] ); #endif #ifndef SUBHASH_H #define SUBHASH_H -unsigned int subhashs(const char *s); -unsigned int subhashb(const char *s,long len); +static unsigned int subhashs(const char *s); +static unsigned int subhashb(const char *s,long len); #define subhashsa(SA) subhashb((SA)->s,(SA)->len) #endif