summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2013-12-01 17:44:34 +0000
committerDimitri Sokolyuk <demon@dim13.org>2013-12-01 17:44:34 +0000
commit329ccb0947fed5c6e141912aad04afec2673b636 (patch)
tree7a4ff46baa6f92a1359eb1d19b08988885e8fbe5
parent23e68ead137278ea976e4485c3571ca7f4c2f157 (diff)
cleanup
-rw-r--r--bf.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/bf.c b/bf.c
index f15d3fc..9302c59 100644
--- a/bf.c
+++ b/bf.c
@@ -15,7 +15,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <assert.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
@@ -36,7 +35,8 @@ alloccell(void)
Cell *c;
c = calloc(1, sizeof(Cell));
- assert(c);
+ if (!c)
+ errx(1, "calloc");
return c;
}
@@ -77,14 +77,15 @@ freadall(char *fname)
fd = fopen(fname, "r");
if (!fd)
- return NULL;
+ errx(1, "cannot open %s", fname);
fseek(fd, 0L, SEEK_END);
len = ftell(fd);
fseek(fd, 0L, SEEK_SET);
buf = calloc(len + 1, sizeof(char));
- assert(buf);
+ if (!buf)
+ errx(1, "calloc");
fread(buf, sizeof(char), len, fd);
fclose(fd);
@@ -103,23 +104,6 @@ usage(void)
}
char *
-walk(char **j, char *p)
-{
- for (; *p; p++, j++)
- switch (*p) {
- case '[':
- *j = walk(j + 1, p + 1);
- break;
- case ']':
- return p;
- default:
- break;
- }
-
- return NULL;
-}
-
-char *
locatejmp(char *prog)
{
for (; *prog; prog++)