diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2015-03-21 17:59:13 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2015-04-21 16:58:08 -0700 |
commit | 0018784cdde19444a8f970bc414796fc2a523a51 (patch) | |
tree | 779eb85d61f1ef33485fea8783b0d7f7080d2276 /hw/dmx/config/dmxconfig.c | |
parent | dc5acaa28ab9ed091f087e56046400d63f1f192a (diff) |
Convert hw/dmx to new *allocarray functions
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'hw/dmx/config/dmxconfig.c')
-rw-r--r-- | hw/dmx/config/dmxconfig.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/hw/dmx/config/dmxconfig.c b/hw/dmx/config/dmxconfig.c index 2cc9ab396..1d10ec018 100644 --- a/hw/dmx/config/dmxconfig.c +++ b/hw/dmx/config/dmxconfig.c @@ -204,8 +204,8 @@ dmxConfigAddDisplay(const char *name, { DMXScreenInfo *dmxScreen; - if (!(dmxScreens = realloc(dmxScreens, - (dmxNumScreens + 1) * sizeof(*dmxScreens)))) + if (!(dmxScreens = reallocarray(dmxScreens, dmxNumScreens + 1, + sizeof(*dmxScreens)))) dmxLog(dmxFatal, "dmxConfigAddDisplay: realloc failed for screen %d (%s)\n", dmxNumScreens, name); @@ -234,8 +234,8 @@ dmxConfigAddInput(const char *name, int core) { DMXInputInfo *dmxInput; - if (!(dmxInputs = realloc(dmxInputs, - (dmxNumInputs + 1) * sizeof(*dmxInputs)))) + if (!(dmxInputs = reallocarray(dmxInputs, dmxNumInputs + 1, + sizeof(*dmxInputs)))) dmxLog(dmxFatal, "dmxConfigAddInput: realloc failed for input %d (%s)\n", dmxNumInputs, name); @@ -341,7 +341,7 @@ dmxConfigCopyFromOption(DMXConfigOptionPtr o) for (pt = o->option; pt; pt = pt->next) { if (pt->string) { ++argc; - argv = realloc(argv, (argc + 1) * sizeof(*argv)); + argv = reallocarray(argv, argc + 1, sizeof(*argv)); argv[argc] = (char *) pt->string; } } |