summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-11-08 15:46:40 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-11-11 04:37:59 +0000
commitc238057ccc8b1bf97c3063e93ebdeec3b8ef10b1 (patch)
tree95aca94bf1368b78acd451328eb2ff5d15185830
parent7139b737246a75b8c08ab10124a0131bddc0ca04 (diff)
downloadzsh-c238057ccc8b1bf97c3063e93ebdeec3b8ef10b1.tar.gz
zsh-c238057ccc8b1bf97c3063e93ebdeec3b8ef10b1.tar.xz
zsh-c238057ccc8b1bf97c3063e93ebdeec3b8ef10b1.zip
39874/0002 plus size=0 handling: zshcalloc: Remove code duplication. No functional change.
-rw-r--r--ChangeLog3
-rw-r--r--Src/mem.c10
2 files changed, 4 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 893b16e2c..ee314487c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2016-11-11  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
+	* 39874/0002 plus size=0 handling: Src/mem.c: zshcalloc: Remove
+	code duplication. No functional change.
+
 	* 39874/0001: Src/params.c: setarrvalue: Remove needless
 	initialization.
 
diff --git a/Src/mem.c b/Src/mem.c
index 8c7eb8017..840bbb6e4 100644
--- a/Src/mem.c
+++ b/Src/mem.c
@@ -976,18 +976,10 @@ zalloc(size_t size)
 mod_export void *
 zshcalloc(size_t size)
 {
-    void *ptr;
-
+    void *ptr = zalloc(size);
     if (!size)
 	size = 1;
-    queue_signals();
-    if (!(ptr = (void *) malloc(size))) {
-	zerr("fatal error: out of memory");
-	exit(1);
-    }
-    unqueue_signals();
     memset(ptr, 0, size);
-
     return ptr;
 }