Fix a compiler warning on Ubuntu 9.10 gcc 4.4.1 in the pattern matchers where the size of the thread ctx can be optimized to 0.

remotes/origin/master-1.0.x
Victor Julien 16 years ago
parent 8b8e2fef2d
commit deb511f51a

@ -130,6 +130,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION

@ -1034,6 +1034,7 @@ void B2gDestroyCtx(MpmCtx *mpm_ctx) {
void B2gThreadInitCtx(MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx, uint32_t matchsize) {
memset(mpm_thread_ctx, 0, sizeof(MpmThreadCtx));
if (sizeof(B2gThreadCtx) > 0) { /* size can be null when optimized */
mpm_thread_ctx->ctx = malloc(sizeof(B2gThreadCtx));
if (mpm_thread_ctx->ctx == NULL)
return;
@ -1042,6 +1043,7 @@ void B2gThreadInitCtx(MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx, uint32_t ma
mpm_thread_ctx->memory_cnt++;
mpm_thread_ctx->memory_size += sizeof(B2gThreadCtx);
}
/* alloc an array with the size of _all_ keys in all instances.
* this is done so the detect engine won't have to care about
@ -1068,16 +1070,16 @@ void B2gThreadDestroyCtx(MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx) {
B2gPrintSearchStats(mpm_thread_ctx);
if (ctx) {
if (mpm_thread_ctx->match != NULL) {
if (ctx != NULL) { /* can be NULL if B2gThreadCtx is optimized to 0 */
mpm_thread_ctx->memory_cnt--;
mpm_thread_ctx->memory_size -= ((mpm_thread_ctx->matchsize + 1) * sizeof(MpmMatchBucket));
free(mpm_thread_ctx->match);
mpm_thread_ctx->memory_size -= sizeof(B2gThreadCtx);
free(mpm_thread_ctx->ctx);
}
if (mpm_thread_ctx->match != NULL) {
mpm_thread_ctx->memory_cnt--;
mpm_thread_ctx->memory_size -= sizeof(B2gThreadCtx);
free(mpm_thread_ctx->ctx);
mpm_thread_ctx->memory_size -= ((mpm_thread_ctx->matchsize + 1) * sizeof(MpmMatchBucket));
free(mpm_thread_ctx->match);
}
MpmMatchFreeSpares(mpm_thread_ctx, mpm_thread_ctx->sparelist);

@ -1084,6 +1084,7 @@ void B3gDestroyCtx(MpmCtx *mpm_ctx) {
void B3gThreadInitCtx(MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx, uint32_t matchsize) {
memset(mpm_thread_ctx, 0, sizeof(MpmThreadCtx));
if (sizeof(B3gThreadCtx) > 0) { /* size can be 0 when optimized */
mpm_thread_ctx->ctx = malloc(sizeof(B3gThreadCtx));
if (mpm_thread_ctx->ctx == NULL)
return;
@ -1092,6 +1093,7 @@ void B3gThreadInitCtx(MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx, uint32_t ma
mpm_thread_ctx->memory_cnt++;
mpm_thread_ctx->memory_size += sizeof(B3gThreadCtx);
}
/* alloc an array with the size of _all_ keys in all instances.
* this is done so the detect engine won't have to care about
@ -1118,16 +1120,16 @@ void B3gThreadDestroyCtx(MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx) {
B3gPrintSearchStats(mpm_thread_ctx);
if (ctx) {
if (mpm_thread_ctx->match != NULL) {
if (ctx != NULL) { /* can be NULL when optimized */
mpm_thread_ctx->memory_cnt--;
mpm_thread_ctx->memory_size -= ((mpm_thread_ctx->matchsize + 1) * sizeof(MpmMatchBucket));
free(mpm_thread_ctx->match);
mpm_thread_ctx->memory_size -= sizeof(B3gThreadCtx);
free(mpm_thread_ctx->ctx);
}
if (mpm_thread_ctx->match != NULL) {
mpm_thread_ctx->memory_cnt--;
mpm_thread_ctx->memory_size -= sizeof(B3gThreadCtx);
free(mpm_thread_ctx->ctx);
mpm_thread_ctx->memory_size -= ((mpm_thread_ctx->matchsize + 1) * sizeof(MpmMatchBucket));
free(mpm_thread_ctx->match);
}
MpmMatchFreeSpares(mpm_thread_ctx, mpm_thread_ctx->sparelist);

@ -2316,6 +2316,7 @@ void WmDestroyCtx(MpmCtx *mpm_ctx) {
void WmThreadInitCtx(MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx, uint32_t matchsize) {
memset(mpm_thread_ctx, 0, sizeof(MpmThreadCtx));
if (sizeof(WmThreadCtx) > 0) { /* size can be 0 when optimized */
mpm_thread_ctx->ctx = malloc(sizeof(WmThreadCtx));
if (mpm_thread_ctx->ctx == NULL)
return;
@ -2324,6 +2325,7 @@ void WmThreadInitCtx(MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx, uint32_t mat
mpm_thread_ctx->memory_cnt++;
mpm_thread_ctx->memory_size += sizeof(WmThreadCtx);
}
/* alloc an array with the size of _all_ keys in all instances.
* this is done so the detect engine won't have to care about
@ -2347,16 +2349,16 @@ void WmThreadInitCtx(MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx, uint32_t mat
void WmThreadDestroyCtx(MpmCtx *mpm_ctx, MpmThreadCtx *mpm_thread_ctx) {
WmThreadCtx *ctx = (WmThreadCtx *)mpm_thread_ctx->ctx;
if (ctx) {
if (mpm_thread_ctx->match != NULL) {
if (ctx != NULL) { /* size can be 0 when optimized */
mpm_thread_ctx->memory_cnt--;
mpm_thread_ctx->memory_size -= ((mpm_thread_ctx->matchsize + 1) * sizeof(MpmMatchBucket));
free(mpm_thread_ctx->match);
mpm_thread_ctx->memory_size -= sizeof(WmThreadCtx);
free(mpm_thread_ctx->ctx);
}
if (mpm_thread_ctx->match != NULL) {
mpm_thread_ctx->memory_cnt--;
mpm_thread_ctx->memory_size -= sizeof(WmThreadCtx);
free(mpm_thread_ctx->ctx);
mpm_thread_ctx->memory_size -= ((mpm_thread_ctx->matchsize + 1) * sizeof(MpmMatchBucket));
free(mpm_thread_ctx->match);
}
MpmMatchFreeSpares(mpm_thread_ctx, mpm_thread_ctx->sparelist);
@ -2410,6 +2412,7 @@ int WmTestInitCtx03 (void) {
}
int WmTestThreadInitCtx01 (void) {
if (sizeof(WmThreadCtx) > 0) {
int result = 0;
MpmCtx mpm_ctx;
memset(&mpm_ctx, 0x00, sizeof(MpmCtx));
@ -2424,6 +2427,9 @@ int WmTestThreadInitCtx01 (void) {
WmThreadDestroyCtx(&mpm_ctx, &mpm_thread_ctx);
WmDestroyCtx(&mpm_ctx);
return result;
} else {
return 1;
}
}
int WmTestThreadInitCtx02 (void) {

Loading…
Cancel
Save