bzero isn't portable, use memset instead. Include bzip2 and snappy source for use by WT block compression

e
This commit is contained in:
Super-User 2013-04-14 21:23:57 +00:00
parent 22643fc312
commit 15a9a70c41
5 changed files with 9 additions and 9 deletions

View file

@ -96,7 +96,7 @@ struct async_nif_state {
return enif_make_tuple2(env, enif_make_atom(env, "error"), \ return enif_make_tuple2(env, enif_make_atom(env, "error"), \
enif_make_atom(env, "enomem")); \ enif_make_atom(env, "enomem")); \
} \ } \
bzero(req, sizeof(struct async_nif_req_entry)); \ memset(req, 0, sizeof(struct async_nif_req_entry)); \
copy_of_args = (struct decl ## _args *)enif_alloc(sizeof(struct decl ## _args)); \ copy_of_args = (struct decl ## _args *)enif_alloc(sizeof(struct decl ## _args)); \
if (!copy_of_args) { \ if (!copy_of_args) { \
fn_post_ ## decl (args); \ fn_post_ ## decl (args); \
@ -278,7 +278,7 @@ async_nif_unload(ErlNifEnv *env)
async_nif->req_count--; async_nif->req_count--;
} }
} }
bzero(async_nif, sizeof(struct async_nif_state)); memset(async_nif, 0, sizeof(struct async_nif_state));
enif_free(async_nif); enif_free(async_nif);
} }
@ -301,7 +301,7 @@ async_nif_load(void)
async_nif = enif_alloc(sizeof(struct async_nif_state)); async_nif = enif_alloc(sizeof(struct async_nif_state));
if (!async_nif) if (!async_nif)
return NULL; return NULL;
bzero(async_nif, sizeof(struct async_nif_state)); memset(async_nif, 0, sizeof(struct async_nif_state));
async_nif->num_queues = info.scheduler_threads; async_nif->num_queues = info.scheduler_threads;
async_nif->next_q = 0; async_nif->next_q = 0;
@ -316,7 +316,7 @@ async_nif_load(void)
} }
/* Setup the thread pool management. */ /* Setup the thread pool management. */
bzero(async_nif->worker_entries, sizeof(struct async_nif_worker_entry) * ASYNC_NIF_MAX_WORKERS); memset(async_nif->worker_entries, 0, sizeof(struct async_nif_worker_entry) * ASYNC_NIF_MAX_WORKERS);
/* Start the worker threads. */ /* Start the worker threads. */
//unsigned int num_workers = ASYNC_NIF_MAX_WORKERS - (ASYNC_NIF_MAX_WORKERS % async_nif->num_queues); //unsigned int num_workers = ASYNC_NIF_MAX_WORKERS - (ASYNC_NIF_MAX_WORKERS % async_nif->num_queues);
@ -348,7 +348,7 @@ async_nif_load(void)
enif_thread_join(async_nif->worker_entries[i].tid, &exit_value); enif_thread_join(async_nif->worker_entries[i].tid, &exit_value);
} }
bzero(async_nif->worker_entries, sizeof(struct async_nif_worker_entry) * ASYNC_NIF_MAX_WORKERS); memset(async_nif->worker_entries, 0, sizeof(struct async_nif_worker_entry) * ASYNC_NIF_MAX_WORKERS);
return NULL; return NULL;
} }
} }

View file

@ -28,9 +28,9 @@ case "$1" in
./autogen.sh) ./autogen.sh)
fi fi
(cd wiredtiger/build_posix && \ (cd wiredtiger/build_posix && \
../configure --with-pic \ CFLAGS="-I/usr/local/include -L/usr/local/lib" \
../configure --with-pic \
--enable-snappy \ --enable-snappy \
--enable-bzip2 \
--prefix=${BASEDIR}/system && \ --prefix=${BASEDIR}/system && \
make -j && make install) make -j && make install)
[ -d ${BASEDIR}/../priv ] || mkdir ${BASEDIR}/../priv [ -d ${BASEDIR}/../priv ] || mkdir ${BASEDIR}/../priv

BIN
c_src/bzip2-1.0.6.tar.gz Normal file

Binary file not shown.

BIN
c_src/snappy-1.0.4.tar.gz Normal file

Binary file not shown.

View file

@ -138,7 +138,7 @@ __close_all_sessions(WterlConnHandle *conn_handle)
} }
kh_destroy(cursors, h); kh_destroy(cursors, h);
session->close(session, NULL); session->close(session, NULL);
bzero(&conn_handle->contexts[i], sizeof(WterlCtx)); memset(&conn_handle->contexts[i], 0, sizeof(WterlCtx));
} }
} }
conn_handle->num_contexts = 0; conn_handle->num_contexts = 0;
@ -297,7 +297,7 @@ ASYNC_NIF_DECL(
} }
conn_handle->conn = conn; conn_handle->conn = conn;
conn_handle->num_contexts = 0; conn_handle->num_contexts = 0;
bzero(conn_handle->contexts, sizeof(WterlCtx) * ASYNC_NIF_MAX_WORKERS); memset(conn_handle->contexts, 0, sizeof(WterlCtx) * ASYNC_NIF_MAX_WORKERS);
conn_handle->context_mutex = enif_mutex_create(NULL); conn_handle->context_mutex = enif_mutex_create(NULL);
ERL_NIF_TERM result = enif_make_resource(env, conn_handle); ERL_NIF_TERM result = enif_make_resource(env, conn_handle);
enif_release_resource(conn_handle); enif_release_resource(conn_handle);