From b2e7e9093964d427d9f604fd3e2f2ae9950f6e79 Mon Sep 17 00:00:00 2001 From: Ricky Zhou Date: Mon, 29 Sep 2008 16:52:41 +0900 Subject: [PATCH] DTrace probe fix, Fix typo in configure script, Use calloc(3) instead of malloc(3) for thread structures. --- configure.ac | 2 +- thread.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index d7bf10ce6a..714f2c9687 100644 --- a/configure.ac +++ b/configure.ac @@ -29,7 +29,7 @@ AC_SUBST(DTRACE_DEBUG_OBJ) AC_SUBST(DTRACEFLAGS) AC_ARG_ENABLE(64bit, - [AS_HELP_STRING([--enable-64bit],[build 64bit verison])]) + [AS_HELP_STRING([--enable-64bit],[build 64bit version])]) if test "x$enable_64bit" == "xyes" then org_cflags=$CFLAGS diff --git a/thread.c b/thread.c index 8d29a504d8..0b16f3458a 100644 --- a/thread.c +++ b/thread.c @@ -386,7 +386,7 @@ void dispatch_conn_new(int sfd, enum conn_states init_state, int event_flags, cq_push(&thread->new_conn_queue, item); - MEMCACHED_CONN_DISPATCH(sfd, threads[thread].thread_id); + MEMCACHED_CONN_DISPATCH(sfd, thread->thread_id); if (write(thread->notify_send_fd, "", 1) != 1) { perror("Writing to thread notify pipe"); } @@ -624,7 +624,7 @@ void thread_init(int nthreads, struct event_base *main_base) { pthread_mutex_init(&cqi_freelist_lock, NULL); cqi_freelist = NULL; - threads = malloc(sizeof(LIBEVENT_THREAD) * nthreads); + threads = calloc(nthreads, sizeof(LIBEVENT_THREAD)); if (! threads) { perror("Can't allocate thread descriptors"); exit(1);