Browse Source

helper.pl - improved detection of static functions without _

Karel Miko 8 years ago
parent
commit
5c34fb2bad
2 changed files with 8 additions and 8 deletions
  1. 2 2
      helper.pl
  2. 6 6
      src/prngs/rng_get_bytes.c

+ 2 - 2
helper.pl

@@ -60,8 +60,8 @@ sub check_source {
           $file !~ m|src/hashes/.*\.c$| &&
           $file !~ m|src/hashes/.*\.c$| &&
           $file !~ m|src/math/.+_desc.c$| &&
           $file !~ m|src/math/.+_desc.c$| &&
           $file !~ m|src/stream/sober128/sober128_stream.c$| &&
           $file !~ m|src/stream/sober128/sober128_stream.c$| &&
-          $l =~ /^static\s+\S+\s+([^_][a-zA-Z0-9_]+)\s*\(/) {
-        push @{$troubles->{staticfunc_name}}, "$lineno($1)";
+          $l =~ /^static(\s+\S+)+\s+([^_][a-zA-Z0-9_]+)\s*\(/) {
+        push @{$troubles->{staticfunc_name}}, "$lineno($2)";
       }
       }
       $lineno++;
       $lineno++;
     }
     }

+ 6 - 6
src/prngs/rng_get_bytes.c

@@ -16,7 +16,7 @@
 
 
 #if defined(LTC_DEVRANDOM) && !defined(_WIN32)
 #if defined(LTC_DEVRANDOM) && !defined(_WIN32)
 /* on *NIX read /dev/random */
 /* on *NIX read /dev/random */
-static unsigned long rng_nix(unsigned char *buf, unsigned long len,
+static unsigned long _rng_nix(unsigned char *buf, unsigned long len,
                              void (*callback)(void))
                              void (*callback)(void))
 {
 {
 #ifdef LTC_NO_FILE
 #ifdef LTC_NO_FILE
@@ -56,7 +56,7 @@ static unsigned long rng_nix(unsigned char *buf, unsigned long len,
 
 
 #define ANSI_RNG
 #define ANSI_RNG
 
 
-static unsigned long rng_ansic(unsigned char *buf, unsigned long len,
+static unsigned long _rng_ansic(unsigned char *buf, unsigned long len,
                                void (*callback)(void))
                                void (*callback)(void))
 {
 {
    clock_t t1;
    clock_t t1;
@@ -97,7 +97,7 @@ static unsigned long rng_ansic(unsigned char *buf, unsigned long len,
 #include <windows.h>
 #include <windows.h>
 #include <wincrypt.h>
 #include <wincrypt.h>
 
 
-static unsigned long rng_win32(unsigned char *buf, unsigned long len,
+static unsigned long _rng_win32(unsigned char *buf, unsigned long len,
                                void (*callback)(void))
                                void (*callback)(void))
 {
 {
    HCRYPTPROV hProv = 0;
    HCRYPTPROV hProv = 0;
@@ -143,12 +143,12 @@ unsigned long rng_get_bytes(unsigned char *out, unsigned long outlen,
 #endif
 #endif
 
 
 #if defined(_WIN32) || defined(_WIN32_WCE)
 #if defined(_WIN32) || defined(_WIN32_WCE)
-   x = rng_win32(out, outlen, callback); if (x != 0) { return x; }
+   x = _rng_win32(out, outlen, callback); if (x != 0) { return x; }
 #elif defined(LTC_DEVRANDOM)
 #elif defined(LTC_DEVRANDOM)
-   x = rng_nix(out, outlen, callback);   if (x != 0) { return x; }
+   x = _rng_nix(out, outlen, callback);   if (x != 0) { return x; }
 #endif
 #endif
 #ifdef ANSI_RNG
 #ifdef ANSI_RNG
-   x = rng_ansic(out, outlen, callback); if (x != 0) { return x; }
+   x = _rng_ansic(out, outlen, callback); if (x != 0) { return x; }
 #endif
 #endif
    return 0;
    return 0;
 }
 }