diff --git a/bash/functions/functions.sh b/bash/functions/functions.sh new file mode 100755 index 0000000..a3b88be --- /dev/null +++ b/bash/functions/functions.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +function run_cmd() +{ + err_code=$(($err_code+1)) + if [[ "$1" == "" ]]; then + echo "Error:Need command to run_cmd() function!" + exit -1 + fi + $1 + if [[ "$?" != "0" ]]; then + echo \"$1\" error >&2 + exit $err_code + fi +} diff --git a/c/malloc_speed_test/pool_list.c b/c/malloc_speed_test/pool_list.c index c02f9e7..bf41fc4 100644 --- a/c/malloc_speed_test/pool_list.c +++ b/c/malloc_speed_test/pool_list.c @@ -5,14 +5,10 @@ #define TRUE 1 #define FALSE 0 -struct object_s { - char val; -}; - struct block_s { struct block_s *next; struct block_s *prev; - struct object_s obj; + char obj[1]; }; struct block_pool { @@ -112,6 +108,11 @@ void pool_free(struct block_pool *bp, void *p) bp->busy_pool = b2; } + +struct object_s { + char val; +}; + int main() { unsigned long long i;