ref: ad801965ed1961ad306bd5611d3a01de34614f55
parent: f9e840758f42671f2e465c869342ce47047ee56c
author: Yaroslav Kolomiiets <yarikos@gmail.com>
date: Fri Aug 5 09:58:06 EDT 2016
cosmetics
--- a/fns.h
+++ b/fns.h
@@ -47,8 +47,6 @@
void atexitkill(int pid);
void* emalloc(ulong);
void* erealloc(void*,ulong);
-char* estrdup(char*);
-long writen(int,void*,long);
uchar* gblen(uchar*,uchar*,int*);
uchar* gbtag(uchar*,uchar*,int*);
--- a/mkfile
+++ b/mkfile
@@ -5,6 +5,7 @@
HFILES=fns.h dat.h
OFILES=\
+ alloc.$O\
cap.$O\
eclip.$O\
egdi.$O\
--- a/msg.c
+++ b/msg.c
@@ -445,7 +445,7 @@
int fd, n;
fd = c->fd;
- if((n = putmsg(buf, sizeof buf, m)) < 0 || writen(fd, buf, n) != n)
+ if((n = putmsg(buf, sizeof buf, m)) < 0 || write(fd, buf, n) != n)
return -1;
return n;
--- a/rd.c
+++ b/rd.c
@@ -25,21 +25,6 @@
exits("usage");
}
-long
-writen(int fd, void* buf, long nbytes)
-{
- long n, sofar;
-
- sofar = 0;
- while(sofar < nbytes){
- n = write(fd, buf, nbytes-sofar);
- if(n <= 0)
- break;
- sofar += n;
- }
- return sofar;
-}
-
static int
startmouseproc(Rdp* c)
{
@@ -367,40 +352,4 @@
sysfatal(Eshort);
for(i = 0; i<n; p+=3)
cmap[i++] = rgb2cmap(p[0], p[1], p[2]);
-}
-
-void*
-emalloc(ulong n)
-{
- void *b;
-
- b = mallocz(n, 1);
- if(b == nil)
- sysfatal("out of memory allocating %lud: %r", n);
- setmalloctag(b, getcallerpc(&n));
- return b;
-}
-
-void*
-erealloc(void *a, ulong n)
-{
- void *b;
-
- b = realloc(a, n);
- if(b == nil)
- sysfatal("out of memory re-allocating %lud: %r", n);
- setrealloctag(b, getcallerpc(&a));
- return b;
-}
-
-char*
-estrdup(char *s)
-{
- char *b;
-
- b = strdup(s);
- if(b == nil)
- sysfatal("strdup: %r");
- setmalloctag(b, getcallerpc(&s));
- return b;
}