initial faces (John Cummings)
This commit is contained in:
parent
663ddde9d0
commit
b330c942b4
7 changed files with 1909 additions and 0 deletions
42
src/cmd/faces/util.c
Normal file
42
src/cmd/faces/util.c
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#include <u.h>
|
||||
#include <libc.h>
|
||||
#include <draw.h>
|
||||
#include <plumb.h>
|
||||
#include <9pclient.h>
|
||||
#include "faces.h"
|
||||
|
||||
void*
|
||||
emalloc(ulong sz)
|
||||
{
|
||||
void *v;
|
||||
v = malloc(sz);
|
||||
if(v == nil) {
|
||||
fprint(2, "out of memory allocating %ld\n", sz);
|
||||
exits("mem");
|
||||
}
|
||||
memset(v, 0, sz);
|
||||
return v;
|
||||
}
|
||||
|
||||
void*
|
||||
erealloc(void *v, ulong sz)
|
||||
{
|
||||
v = realloc(v, sz);
|
||||
if(v == nil) {
|
||||
fprint(2, "out of memory allocating %ld\n", sz);
|
||||
exits("mem");
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
char*
|
||||
estrdup(char *s)
|
||||
{
|
||||
char *t;
|
||||
if((t = strdup(s)) == nil) {
|
||||
fprint(2, "out of memory in strdup(%.10s)\n", s);
|
||||
exits("mem");
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue