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/input | |
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/input')
-rw-r--r-- | hw/dmx/input/dmxarg.c | 2 | ||||
-rw-r--r-- | hw/dmx/input/dmxinputinit.c | 4 | ||||
-rw-r--r-- | hw/dmx/input/dmxmotion.c | 5 |
3 files changed, 5 insertions, 6 deletions
diff --git a/hw/dmx/input/dmxarg.c b/hw/dmx/input/dmxarg.c index 4a74b4c9e..6c21ae959 100644 --- a/hw/dmx/input/dmxarg.c +++ b/hw/dmx/input/dmxarg.c @@ -86,7 +86,7 @@ void dmxArgAdd(dmxArg a, const char *string) { if (a->argm <= a->argc + 2) - a->argv = realloc(a->argv, sizeof(*a->argv) * (a->argm *= 2)); + a->argv = reallocarray(a->argv, (a->argm *= 2), sizeof(*a->argv)); a->argv[a->argc++] = strdup(string); a->argv[a->argc] = NULL; } diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c index 56a39df8c..cdefd9ae0 100644 --- a/hw/dmx/input/dmxinputinit.c +++ b/hw/dmx/input/dmxinputinit.c @@ -814,8 +814,8 @@ dmxInputCopyLocal(DMXInputInfo * dmxInput, DMXLocalInputInfoPtr s) dmxLocal->deviceId = -1; ++dmxInput->numDevs; - dmxInput->devs = realloc(dmxInput->devs, - dmxInput->numDevs * sizeof(*dmxInput->devs)); + dmxInput->devs = reallocarray(dmxInput->devs, + dmxInput->numDevs, sizeof(*dmxInput->devs)); dmxInput->devs[dmxInput->numDevs - 1] = dmxLocal; return dmxLocal; diff --git a/hw/dmx/input/dmxmotion.c b/hw/dmx/input/dmxmotion.c index 1642894a2..7f2cb8ed9 100644 --- a/hw/dmx/input/dmxmotion.c +++ b/hw/dmx/input/dmxmotion.c @@ -113,9 +113,8 @@ dmxPointerPutMotionEvent(DeviceIntPtr pDevice, int i; if (!dmxLocal->history) { - dmxLocal->history = malloc(sizeof(*dmxLocal->history) - * (numAxes + 1) - * DMX_MOTION_SIZE); + dmxLocal->history = xallocarray(numAxes + 1, + sizeof(*dmxLocal->history) * DMX_MOTION_SIZE); dmxLocal->head = 0; dmxLocal->tail = 0; dmxLocal->valuators = calloc(sizeof(*dmxLocal->valuators), numAxes); |