Skip to content

Commit

Permalink
libsepol: remove leftovers of cil_mem_error_handler
Browse files Browse the repository at this point in the history
Commit 4459d63 ("libsepol: Remove cil_mem_error_handler() function
pointer") replaced cil_mem_error_handler usage with inline contents of
the default handler. However, it left over the header declaration and
two callers. Convert these as well and remove the header declaration.

This also fixes a build failure with -fno-common.

Fixes: 4459d63 ("libsepol: Remove cil_mem_error_handler() function pointer")
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
  • Loading branch information
WOnder93 authored and jwcart2 committed Jan 27, 2020
1 parent a96e8c5 commit 3d32fc2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion libsepol/cil/src/cil_mem.h
Expand Up @@ -36,7 +36,6 @@ void *cil_calloc(size_t num_elements, size_t element_size);
void *cil_realloc(void *ptr, size_t size);
char *cil_strdup(const char *str);
int cil_asprintf(char **strp, const char *fmt, ...);
void (*cil_mem_error_handler)(void);

#endif /* CIL_MEM_H_ */

8 changes: 4 additions & 4 deletions libsepol/cil/src/cil_strpool.c
Expand Up @@ -80,8 +80,8 @@ char *cil_strpool_add(const char *str)
int rc = hashtab_insert(cil_strpool_tab, (hashtab_key_t)strpool_ref->str, strpool_ref);
if (rc != SEPOL_OK) {
pthread_mutex_unlock(&cil_strpool_mutex);
(*cil_mem_error_handler)();
pthread_mutex_lock(&cil_strpool_mutex);
cil_log(CIL_ERR, "Failed to allocate memory\n");
exit(1);
}
}

Expand All @@ -104,8 +104,8 @@ void cil_strpool_init(void)
cil_strpool_tab = hashtab_create(cil_strpool_hash, cil_strpool_compare, CIL_STRPOOL_TABLE_SIZE);
if (cil_strpool_tab == NULL) {
pthread_mutex_unlock(&cil_strpool_mutex);
(*cil_mem_error_handler)();
return;
cil_log(CIL_ERR, "Failed to allocate memory\n");
exit(1);
}
}
cil_strpool_readers++;
Expand Down

0 comments on commit 3d32fc2

Please sign in to comment.