mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
let's try this again... *all* compilation and linking in Asterisk should be done using the standard compilation rules, not manually created ones. changing hashtest.c to use these rules caused the compiler to notice a large number of coding guidelines violations, so those are fixed too.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@90150 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -150,10 +150,9 @@ hashtest2: hashtest2.o md5.o utils.o astobj2.o sha1.o strcompat.o threadstorage.
|
|||||||
|
|
||||||
hashtest: hashtest.o md5.o hashtab.o utils.o sha1.o strcompat.o threadstorage.o clicompat.o
|
hashtest: hashtest.o md5.o hashtab.o utils.o sha1.o strcompat.o threadstorage.o clicompat.o
|
||||||
|
|
||||||
hashtest.o : hashtest.c
|
hashtest.o: ASTCFLAGS+=-O0
|
||||||
$(CC) -g -O0 -c hashtest.c -I/usr/include -I../include
|
|
||||||
|
|
||||||
extconf.o : extconf.c
|
extconf.o: extconf.c
|
||||||
|
|
||||||
conf2ael: conf2ael.o ast_expr2f.o ast_expr2.o aelbison.o aelparse.o pbx_ael.o pval.o extconf.o strcompat.o
|
conf2ael: conf2ael.o ast_expr2f.o ast_expr2.o aelbison.o aelparse.o pbx_ael.o pval.o extconf.o strcompat.o
|
||||||
|
|
||||||
|
@@ -46,6 +46,7 @@ int testno = 1;
|
|||||||
|
|
||||||
int64_t ast_mark(int prof_id, int x)
|
int64_t ast_mark(int prof_id, int x)
|
||||||
{
|
{
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ht_element
|
struct ht_element
|
||||||
@@ -60,6 +61,7 @@ static int hashtab_compare_strings_nocase(const void *a, const void *b)
|
|||||||
return ast_hashtab_compare_strings_nocase(ae->key, be->key);
|
return ast_hashtab_compare_strings_nocase(ae->key, be->key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static int hashtab_compare_strings(const void *a, const void *b)
|
static int hashtab_compare_strings(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
const struct ht_element *ae = a, *be = b;
|
const struct ht_element *ae = a, *be = b;
|
||||||
@@ -71,6 +73,7 @@ static unsigned int hashtab_hash_string(const void *obj)
|
|||||||
const struct ht_element *o = obj;
|
const struct ht_element *o = obj;
|
||||||
return ast_hashtab_hash_string((const void *)o->key);
|
return ast_hashtab_hash_string((const void *)o->key);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static unsigned int hashtab_hash_string_nocase(const void *obj)
|
static unsigned int hashtab_hash_string_nocase(const void *obj)
|
||||||
{
|
{
|
||||||
@@ -80,7 +83,7 @@ static unsigned int hashtab_hash_string_nocase(const void *obj)
|
|||||||
|
|
||||||
/* random numbers */
|
/* random numbers */
|
||||||
|
|
||||||
my_rand(int incl_low, int incl_high, unsigned int *seedp)
|
static int my_rand(int incl_low, int incl_high, unsigned int *seedp)
|
||||||
{
|
{
|
||||||
if (incl_high == 0)
|
if (incl_high == 0)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -139,14 +142,14 @@ static void * del_element(unsigned int *seedp)
|
|||||||
/* pick a random element from 0 to highwater-1 */
|
/* pick a random element from 0 to highwater-1 */
|
||||||
x = my_rand(0,glob_highwater-1,seedp);
|
x = my_rand(0,glob_highwater-1,seedp);
|
||||||
sprintf(keybuf, "key%08d", x);
|
sprintf(keybuf, "key%08d", x);
|
||||||
#if DEBUG
|
#ifdef DEBUG
|
||||||
printf("Removing %s", keybuf);
|
printf("Removing %s", keybuf);
|
||||||
#endif
|
#endif
|
||||||
lookup.key = keybuf;
|
lookup.key = keybuf;
|
||||||
el = ast_hashtab_remove_object_via_lookup(glob_hashtab, &lookup);
|
el = ast_hashtab_remove_object_via_lookup(glob_hashtab, &lookup);
|
||||||
|
|
||||||
if (el) {
|
if (el) {
|
||||||
#if DEBUG
|
#ifdef DEBUG
|
||||||
printf("...YES (el=%x)\n", (unsigned long)el);
|
printf("...YES (el=%x)\n", (unsigned long)el);
|
||||||
#endif
|
#endif
|
||||||
free(el->key);
|
free(el->key);
|
||||||
@@ -154,7 +157,7 @@ static void * del_element(unsigned int *seedp)
|
|||||||
free(el);
|
free(el);
|
||||||
els_removed++;
|
els_removed++;
|
||||||
} else {
|
} else {
|
||||||
#if DEBUG
|
#ifdef DEBUG
|
||||||
printf("...NO.\n");
|
printf("...NO.\n");
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
@@ -192,13 +195,14 @@ static void *hashtest(void *data)
|
|||||||
int my_els_found = 0;
|
int my_els_found = 0;
|
||||||
int my_els_traversals = 0;
|
int my_els_traversals = 0;
|
||||||
int my_testno = testno++;
|
int my_testno = testno++;
|
||||||
|
int its;
|
||||||
|
|
||||||
/* data will be a random number == use as a seed for random numbers */
|
/* data will be a random number == use as a seed for random numbers */
|
||||||
unsigned long seed = (unsigned long)data;
|
unsigned long seed = (unsigned long)data;
|
||||||
|
|
||||||
printf("hashtest thread created... test beginning\n");
|
printf("hashtest thread created... test beginning\n");
|
||||||
|
|
||||||
/* main test routine-- a global hashtab exists, pound it like crazy */
|
/* main test routine-- a global hashtab exists, pound it like crazy */
|
||||||
int its;
|
|
||||||
for(its=0;its<100000;its++)
|
for(its=0;its<100000;its++)
|
||||||
{
|
{
|
||||||
void *seed2 = &seed;
|
void *seed2 = &seed;
|
||||||
@@ -242,7 +246,7 @@ static void *hashtest(void *data)
|
|||||||
pthread_exit(0);
|
pthread_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void run_hashtest(int numthr)
|
static void run_hashtest(int numthr)
|
||||||
{
|
{
|
||||||
pthread_t thr[numthr];
|
pthread_t thr[numthr];
|
||||||
void *thrres[numthr];
|
void *thrres[numthr];
|
||||||
@@ -296,14 +300,9 @@ int main(int argc,char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct ast_app *pbx_findapp(const char *app)
|
|
||||||
{
|
|
||||||
return (struct ast_app*)1; /* so as not to trigger an error */
|
|
||||||
}
|
|
||||||
|
|
||||||
int ast_add_profile(const char *x, uint64_t scale)
|
int ast_add_profile(const char *x, uint64_t scale)
|
||||||
{
|
{
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ast_loader_register(int (*updater)(void))
|
int ast_loader_register(int (*updater)(void))
|
||||||
@@ -333,10 +332,6 @@ void ast_unregister_file_version(const char *file)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ast_context_destroy(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)
|
void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list vars;
|
va_list vars;
|
||||||
|
Reference in New Issue
Block a user