diff options
author | charnier <charnier@FreeBSD.org> | 2003-06-15 09:28:17 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 2003-06-15 09:28:17 +0000 |
commit | d46a4b84c36ffc40eac467a205717414ef8311c0 (patch) | |
tree | 8b645c361f8cd29562d33fc7a6cd5e073458ffaa /usr.bin/indent/indent_globs.h | |
parent | 7b4b7a670b84034ab40c33b9bdda786293e36dfe (diff) | |
download | FreeBSD-src-d46a4b84c36ffc40eac467a205717414ef8311c0.zip FreeBSD-src-d46a4b84c36ffc40eac467a205717414ef8311c0.tar.gz |
err() on allocation failure. WARNS=9 compliant
use #if 0, #ifndef lint, #endif /* not lint */, #endif ordering
when a message is provided, use errx() instead of err().
Diffstat (limited to 'usr.bin/indent/indent_globs.h')
-rw-r--r-- | usr.bin/indent/indent_globs.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/usr.bin/indent/indent_globs.h b/usr.bin/indent/indent_globs.h index 9f319e0..c189bfd 100644 --- a/usr.bin/indent/indent_globs.h +++ b/usr.bin/indent/indent_globs.h @@ -58,6 +58,8 @@ FILE *output; /* the output file */ if (e_code >= l_code) { \ int nsize = l_code-s_code+400; \ codebuf = (char *) realloc(codebuf, nsize); \ + if (codebuf == NULL) \ + err(1, NULL); \ e_code = codebuf + (e_code-s_code) + 1; \ l_code = codebuf + nsize - 5; \ s_code = codebuf + 1; \ @@ -66,6 +68,8 @@ FILE *output; /* the output file */ if (e_com >= l_com) { \ int nsize = l_com-s_com+400; \ combuf = (char *) realloc(combuf, nsize); \ + if (combuf == NULL) \ + err(1, NULL); \ e_com = combuf + (e_com-s_com) + 1; \ l_com = combuf + nsize - 5; \ s_com = combuf + 1; \ @@ -74,6 +78,8 @@ FILE *output; /* the output file */ if (e_lab >= l_lab) { \ int nsize = l_lab-s_lab+400; \ labbuf = (char *) realloc(labbuf, nsize); \ + if (labbuf == NULL) \ + err(1, NULL); \ e_lab = labbuf + (e_lab-s_lab) + 1; \ l_lab = labbuf + nsize - 5; \ s_lab = labbuf + 1; \ @@ -82,6 +88,8 @@ FILE *output; /* the output file */ if (e_token >= l_token) { \ int nsize = l_token-s_token+400; \ tokenbuf = (char *) realloc(tokenbuf, nsize); \ + if (tokenbuf == NULL) \ + err(1, NULL); \ e_token = tokenbuf + (e_token-s_token) + 1; \ l_token = tokenbuf + nsize - 5; \ s_token = tokenbuf + 1; \ |