ref: b8433f9421cc3b1140a21da7b82b7ba07abea59c
parent: 4e314a501c2c97b00f237afe14937febbb293e70
author: mkf <mkf@cloud9p.org>
date: Tue May 14 04:17:57 EDT 2024
small changes, malloc → emalloc
--- a/cli.c
+++ b/cli.c
@@ -172,7 +172,7 @@
case '\0':
break;
default:
- fprint(2, "proc(): huh?\n");
+ fprint(2, "unknown command\n");
}
/* only print the map if turn have changed */
if(turn != oturn)
@@ -181,15 +181,12 @@
int
input(void)
-{ char *s, *r;
+{ char s[32], *r;
int t;
-
- /* sang bozorg */
- s = malloc(1024);
print("%s> ", turn % 2 ? "glendy" : "trapper");
fflush(stdout); /* plan 9 */
- r = fgets(s, 1024, stdin);
+ r = fgets(s, 32, stdin);
if(r == nil)
{
fprint(2, "input(): error\n");
--- a/netclient.c
+++ b/netclient.c
@@ -24,7 +24,7 @@
if(d == nil)
return nil;
- msg = (char*)malloc(8);
+ msg = (char*)emalloc(8);
sprint(msg, "m %s\n", d);
return msg;
}
@@ -37,7 +37,7 @@
if(x > SzX || x < 0 || y > SzY || y < 0)
return nil;
- msg = (char*)malloc(10);
+ msg = (char*)emalloc(10);
sprint(msg, "p %d %d\n", x, y);
return msg;
}
@@ -89,7 +89,7 @@
{
int i, dir;
char *tmp, *xpos, *ypos;
- char **tokens = (char**)malloc(64 * sizeof(char*));;
+ char **tokens = (char**)emalloc(64 * sizeof(char*));
Point p;
msg->omsg = strdup(in);
--- a/util.c
+++ b/util.c
@@ -117,7 +117,7 @@
p = malloc(n);
if(p == nil)
- sysfatal("mallocz: %r");
+ sysfatal("malloc: %r");
return p;
}