helper.pl - improved detection of static functions without _

This commit is contained in:
Karel Miko 2017-11-05 11:40:01 +01:00
parent 617698e544
commit 5c34fb2bad
2 changed files with 8 additions and 8 deletions

View File

@ -60,8 +60,8 @@ sub check_source {
$file !~ m|src/hashes/.*\.c$| &&
$file !~ m|src/math/.+_desc.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++;
}

View File

@ -16,7 +16,7 @@
#if defined(LTC_DEVRANDOM) && !defined(_WIN32)
/* 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))
{
#ifdef LTC_NO_FILE
@ -56,7 +56,7 @@ static unsigned long rng_nix(unsigned char *buf, unsigned long len,
#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))
{
clock_t t1;
@ -97,7 +97,7 @@ static unsigned long rng_ansic(unsigned char *buf, unsigned long len,
#include <windows.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))
{
HCRYPTPROV hProv = 0;
@ -143,12 +143,12 @@ unsigned long rng_get_bytes(unsigned char *out, unsigned long outlen,
#endif
#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)
x = rng_nix(out, outlen, callback); if (x != 0) { return x; }
x = _rng_nix(out, outlen, callback); if (x != 0) { return x; }
#endif
#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
return 0;
}