Terminate statements (with macros) with semi-colons

This commit is contained in:
Shahram Najm 2023-06-26 19:52:25 +01:00
parent 8b1e519ac3
commit 7dc8a1a4a6
7 changed files with 26 additions and 27 deletions

View File

@ -306,7 +306,7 @@ static grib_concept_value* get_concept_impl(grib_handle* h, grib_action_concept*
static grib_concept_value* get_concept(grib_handle* h, grib_action_concept* self) static grib_concept_value* get_concept(grib_handle* h, grib_action_concept* self)
{ {
grib_concept_value* result = NULL; grib_concept_value* result = NULL;
GRIB_MUTEX_INIT_ONCE(&once, &init) GRIB_MUTEX_INIT_ONCE(&once, &init);
GRIB_MUTEX_LOCK(&mutex); GRIB_MUTEX_LOCK(&mutex);
result = get_concept_impl(h, self); result = get_concept_impl(h, self);

View File

@ -306,10 +306,10 @@ static int grib_load_smart_table(grib_context* c, const char* filename,
t->recomposed_name[0] = grib_context_strdup_persistent(c, recomposed_name); t->recomposed_name[0] = grib_context_strdup_persistent(c, recomposed_name);
t->next = c->smart_table; t->next = c->smart_table;
t->numberOfEntries = size; t->numberOfEntries = size;
GRIB_MUTEX_INIT_ONCE(&once, &thread_init) GRIB_MUTEX_INIT_ONCE(&once, &thread_init);
GRIB_MUTEX_LOCK(&mutex) GRIB_MUTEX_LOCK(&mutex);
c->smart_table = t; c->smart_table = t;
GRIB_MUTEX_UNLOCK(&mutex) GRIB_MUTEX_UNLOCK(&mutex);
} }
else if (t->filename[1] == NULL) { else if (t->filename[1] == NULL) {
t->filename[1] = grib_context_strdup_persistent(c, filename); t->filename[1] = grib_context_strdup_persistent(c, filename);

View File

@ -80,13 +80,13 @@ static void init_ibm_table()
static void init_table_if_needed() static void init_table_if_needed()
{ {
GRIB_MUTEX_INIT_ONCE(&once, &init) GRIB_MUTEX_INIT_ONCE(&once, &init);
GRIB_MUTEX_LOCK(&mutex) GRIB_MUTEX_LOCK(&mutex);
if (!ibm_table.inited) if (!ibm_table.inited)
init_ibm_table(); init_ibm_table();
GRIB_MUTEX_UNLOCK(&mutex) GRIB_MUTEX_UNLOCK(&mutex);
} }
static void binary_search(const double xx[], const unsigned long n, double x, unsigned long* j) static void binary_search(const double xx[], const unsigned long n, double x, unsigned long* j)

View File

@ -10,7 +10,6 @@
/*************************************************************************** /***************************************************************************
* Enrico Fucile - 06.01.2009 * * Enrico Fucile - 06.01.2009 *
* *
***************************************************************************/ ***************************************************************************/
#include "grib_ieeefloat.h" #include "grib_ieeefloat.h"
@ -86,13 +85,13 @@ static void init_ieee_table()
static void init_table_if_needed() static void init_table_if_needed()
{ {
GRIB_MUTEX_INIT_ONCE(&once, &init) GRIB_MUTEX_INIT_ONCE(&once, &init);
GRIB_MUTEX_LOCK(&mutex) GRIB_MUTEX_LOCK(&mutex);
if (!ieee_table.inited) if (!ieee_table.inited)
init_ieee_table(); init_ieee_table();
GRIB_MUTEX_UNLOCK(&mutex) GRIB_MUTEX_UNLOCK(&mutex);
} }
static void binary_search(const double xx[], const unsigned long n, double x, unsigned long* j) static void binary_search(const double xx[], const unsigned long n, double x, unsigned long* j)

View File

@ -319,7 +319,7 @@ grib_itrie* grib_itrie_new(grib_context* c, int* count)
void grib_itrie_delete(grib_itrie* t) void grib_itrie_delete(grib_itrie* t)
{ {
GRIB_MUTEX_INIT_ONCE(&once, &init) GRIB_MUTEX_INIT_ONCE(&once, &init);
GRIB_MUTEX_LOCK(&mutex); GRIB_MUTEX_LOCK(&mutex);
if (t) { if (t) {

View File

@ -108,8 +108,8 @@ static void* fast_new(size_t s, mempool* pool)
char* p; char* p;
memblk* m; memblk* m;
GRIB_MUTEX_INIT_ONCE(&once, &init) GRIB_MUTEX_INIT_ONCE(&once, &init);
GRIB_MUTEX_LOCK(&mutex) GRIB_MUTEX_LOCK(&mutex);
m = (memblk*)pool->priv; m = (memblk*)pool->priv;
@ -141,7 +141,7 @@ static void* fast_new(size_t s, mempool* pool)
p = (memblk*)(pool->clear ? calloc(size, 1) : malloc(size)); p = (memblk*)(pool->clear ? calloc(size, 1) : malloc(size));
if (!p) { if (!p) {
GRIB_MUTEX_UNLOCK(&mutex) GRIB_MUTEX_UNLOCK(&mutex);
return NULL; return NULL;
} }
@ -156,7 +156,7 @@ static void* fast_new(size_t s, mempool* pool)
m->left -= s; m->left -= s;
m->cnt++; m->cnt++;
GRIB_MUTEX_UNLOCK(&mutex) GRIB_MUTEX_UNLOCK(&mutex);
return p; return p;
} }
@ -167,8 +167,8 @@ static void fast_delete(void* p, mempool* pool)
memblk* m; memblk* m;
memblk* n = NULL; memblk* n = NULL;
GRIB_MUTEX_INIT_ONCE(&once, &init) GRIB_MUTEX_INIT_ONCE(&once, &init);
GRIB_MUTEX_LOCK(&mutex) GRIB_MUTEX_LOCK(&mutex);
m = (memblk*)pool->priv; m = (memblk*)pool->priv;
@ -183,7 +183,7 @@ static void fast_delete(void* p, mempool* pool)
pool->priv = (void*)m->next; pool->priv = (void*)m->next;
free((void*)m); free((void*)m);
} }
GRIB_MUTEX_UNLOCK(&mutex) GRIB_MUTEX_UNLOCK(&mutex);
return; return;
} }
@ -271,8 +271,8 @@ void* grib_buffer_malloc(const grib_context* c, size_t s)
{ {
memblk* r; memblk* r;
GRIB_MUTEX_INIT_ONCE(&once, &init) GRIB_MUTEX_INIT_ONCE(&once, &init);
GRIB_MUTEX_LOCK(&mutex) GRIB_MUTEX_LOCK(&mutex);
s = ((s + WORD - 1) / WORD) * WORD; s = ((s + WORD - 1) / WORD) * WORD;
r = reserve; r = reserve;
@ -297,7 +297,7 @@ void* grib_buffer_malloc(const grib_context* c, size_t s)
r->size = s; r->size = s;
r->cnt = 1; r->cnt = 1;
GRIB_MUTEX_UNLOCK(&mutex) GRIB_MUTEX_UNLOCK(&mutex);
return &r->buffer[0]; return &r->buffer[0];
} }
@ -307,8 +307,8 @@ void grib_buffer_free(const grib_context* c, void* p)
memblk* r; memblk* r;
memblk* s; memblk* s;
GRIB_MUTEX_INIT_ONCE(&once, &init) GRIB_MUTEX_INIT_ONCE(&once, &init);
GRIB_MUTEX_LOCK(&mutex) GRIB_MUTEX_LOCK(&mutex);
r = (memblk*)(((char*)p) - HEADER_SIZE); r = (memblk*)(((char*)p) - HEADER_SIZE);
s = reserve; s = reserve;
@ -320,7 +320,7 @@ void grib_buffer_free(const grib_context* c, void* p)
s->cnt = 0; s->cnt = 0;
} }
GRIB_MUTEX_UNLOCK(&mutex) GRIB_MUTEX_UNLOCK(&mutex);
} }
void* grib_buffer_realloc(const grib_context* c, void* p, size_t s) void* grib_buffer_realloc(const grib_context* c, void* p, size_t s)

View File

@ -752,12 +752,12 @@ static grib_action* grib_parse_stream(grib_context* gc, const char* filename)
if (parse(gc, filename) == 0) { if (parse(gc, filename) == 0) {
if (grib_parser_all_actions) { if (grib_parser_all_actions) {
GRIB_MUTEX_UNLOCK(&mutex_stream) GRIB_MUTEX_UNLOCK(&mutex_stream);
return grib_parser_all_actions; return grib_parser_all_actions;
} }
else { else {
grib_action* ret = grib_action_create_noop(gc, filename); grib_action* ret = grib_action_create_noop(gc, filename);
GRIB_MUTEX_UNLOCK(&mutex_stream) GRIB_MUTEX_UNLOCK(&mutex_stream);
return ret; return ret;
} }
} }