From 0af0bf311d7d54349064c058dd7c62efff3cc9b1 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Sat, 30 Apr 2011 17:23:19 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D1=84=D0=B0=D0=B9=D0=BB=20=D1=81=20=D1=84=D1=83=D0=BD?= =?UTF-8?q?=D0=BA=D1=86=D0=B8=D1=8F=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bash/functions/functions.sh | 15 +++++++++++++++ c/malloc_speed_test/pool_list.c | 11 ++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) create mode 100755 bash/functions/functions.sh 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;