Don't report allocation failure via logging

They will be reported by allocchk and will abort the program. There is
no point to log them.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2018-12-20 14:21:41 +00:00
parent 1ea611c90e
commit 22669889eb
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
4 changed files with 0 additions and 23 deletions

View File

@ -384,9 +384,6 @@ c2_parse(session_t *ps, c2_lptr_t **pcondlst, const char *pattern,
{ {
static const c2_lptr_t lptr_def = C2_LPTR_INIT; static const c2_lptr_t lptr_def = C2_LPTR_INIT;
auto plptr = cmalloc(c2_lptr_t); auto plptr = cmalloc(c2_lptr_t);
if (!plptr)
printf_errfq(1, "(): Failed to allocate memory for new condition linked"
" list element.");
memcpy(plptr, &lptr_def, sizeof(c2_lptr_t)); memcpy(plptr, &lptr_def, sizeof(c2_lptr_t));
plptr->ptr = result; plptr->ptr = result;
plptr->data = data; plptr->data = data;
@ -611,8 +608,6 @@ c2_parse_target(session_t *ps, const char *pattern, int offset, c2_ptr_t *presul
// Initialize leaf // Initialize leaf
presult->isbranch = false; presult->isbranch = false;
presult->l = cmalloc(c2_l_t); presult->l = cmalloc(c2_l_t);
if (!presult->l)
c2_error("Failed to allocate memory for new leaf.");
c2_l_t * const pleaf = presult->l; c2_l_t * const pleaf = presult->l;
memcpy(pleaf, &leaf_def, sizeof(c2_l_t)); memcpy(pleaf, &leaf_def, sizeof(c2_l_t));
@ -1008,8 +1003,6 @@ c2_parse_legacy(session_t *ps, const char *pattern, int offset, c2_ptr_t *presul
// Allocate memory for new leaf // Allocate memory for new leaf
auto pleaf = cmalloc(c2_l_t); auto pleaf = cmalloc(c2_l_t);
if (!pleaf)
printf_errfq(1, "(): Failed to allocate memory for new leaf.");
presult->isbranch = false; presult->isbranch = false;
presult->l = pleaf; presult->l = pleaf;
memcpy(pleaf, &leaf_def, sizeof(c2_l_t)); memcpy(pleaf, &leaf_def, sizeof(c2_l_t));
@ -1098,8 +1091,6 @@ c2_l_postprocess(session_t *ps, c2_l_t *pleaf) {
} }
if (!found) { if (!found) {
auto pnew = cmalloc(latom_t); auto pnew = cmalloc(latom_t);
if (!pnew)
printf_errfq(1, "(): Failed to allocate memory for new track atom.");
pnew->next = ps->track_atom_lst; pnew->next = ps->track_atom_lst;
pnew->atom = pleaf->tgtatom; pnew->atom = pleaf->tgtatom;
ps->track_atom_lst = pnew; ps->track_atom_lst = pnew;

View File

@ -91,10 +91,6 @@ parse_matrix(session_t *ps, const char *src, const char **endptr) {
// Allocate memory // Allocate memory
auto matrix = ccalloc(wid * hei + 2, xcb_render_fixed_t); auto matrix = ccalloc(wid * hei + 2, xcb_render_fixed_t);
if (!matrix) {
printf_errf("(): Failed to allocate memory for matrix.");
goto err1;
}
// Read elements // Read elements
{ {

View File

@ -572,10 +572,6 @@ glx_init_blur(session_t *ps) {
strlen(FRAG_SHADER_BLUR_SUFFIX) + strlen(FRAG_SHADER_BLUR_SUFFIX) +
strlen(texture_func) + 12 + 1; strlen(texture_func) + 12 + 1;
char *shader_str = ccalloc(len, char); char *shader_str = ccalloc(len, char);
if (!shader_str) {
printf_errf("(): Failed to allocate %d bytes for shader string.", len);
return false;
}
{ {
char *pc = shader_str; char *pc = shader_str;
sprintf(pc, FRAG_SHADER_BLUR_PREFIX, extension, sampler_type); sprintf(pc, FRAG_SHADER_BLUR_PREFIX, extension, sampler_type);
@ -596,7 +592,6 @@ glx_init_blur(session_t *ps) {
assert(strlen(shader_str) < len); assert(strlen(shader_str) < len);
} }
} }
sprintf(pc, FRAG_SHADER_BLUR_SUFFIX, texture_func, sum); sprintf(pc, FRAG_SHADER_BLUR_SUFFIX, texture_func, sum);
assert(strlen(shader_str) < len); assert(strlen(shader_str) < len);
} }

View File

@ -768,11 +768,6 @@ win_blur_background(session_t *ps, win *w, xcb_render_picture_t tgt_buffer,
// Allocate cache space if needed // Allocate cache space if needed
if (!kern_dst) { if (!kern_dst) {
kern_dst = ccalloc(kwid * khei + 2, xcb_render_fixed_t); kern_dst = ccalloc(kwid * khei + 2, xcb_render_fixed_t);
if (!kern_dst) {
printf_errf("(): Failed to allocate memory "
"for blur kernel.");
return;
}
ps->blur_kerns_cache[i] = kern_dst; ps->blur_kerns_cache[i] = kern_dst;
} }