mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-12-29 16:25:35 +01:00
39874/0002 plus size=0 handling: zshcalloc: Remove code duplication. No functional change.
This commit is contained in:
parent
7139b73724
commit
c238057ccc
2 changed files with 4 additions and 9 deletions
|
@ -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.
|
||||
|
||||
|
|
10
Src/mem.c
10
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue