summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-01-03 01:52:03 +0100
committerJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-01-03 01:52:03 +0100
commit1e7446e22af32d48f8db1d3e0fc067ef724282fa (patch)
treeeada6b3b3bc52fe7d8fb5c33e98103a3f9c25763
parentcde36665e2e5fbd1d5be70e5ca388a5d2d2365ef (diff)
downloadratpoison-1e7446e22af32d48f8db1d3e0fc067ef724282fa.zip
Tiny xmalloc/realloc/strdup cleanup.
* kill "register" * compare pointers against NULL * separate declarations and code
-rw-r--r--src/main.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index c046d30..886ed99 100644
--- a/src/main.c
+++ b/src/main.c
@@ -71,8 +71,10 @@ fatal (const char *msg)
void *
xmalloc (size_t size)
{
- register void *value = malloc (size);
- if (value == 0)
+ void *value;
+
+ value = malloc (size);
+ if (value == NULL)
fatal ("Virtual memory exhausted");
return value;
}
@@ -80,8 +82,10 @@ xmalloc (size_t size)
void *
xrealloc (void *ptr, size_t size)
{
- register void *value = realloc (ptr, size);
- if (value == 0)
+ void *value;
+
+ value = realloc (ptr, size);
+ if (value == NULL)
fatal ("Virtual memory exhausted");
return value;
}
@@ -91,7 +95,7 @@ xstrdup (const char *s)
{
char *value;
value = strdup (s);
- if (value == 0)
+ if (value == NULL)
fatal ("Virtual memory exhausted");
return value;
}