From: Roi Dayan Date: Mon, 22 Feb 2021 12:10:30 +0000 (+0200) Subject: dcb: Fix compilation warning about reallocarray X-Git-Tag: v5.12.0~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f366536edb5158343152604e82b968be46dbf26;p=thirdparty%2Fiproute2.git dcb: Fix compilation warning about reallocarray In older distros we need bsd/stdlib.h but newer distro doesn't need it. Also old distro will need libbsd-devel installed and newer doesn't. To remove a possible dependency on libbsd-devel replace usage of reallocarray to realloc. dcb_app.c: In function ‘dcb_app_table_push’: dcb_app.c:68:25: warning: implicit declaration of function ‘reallocarray’; did you mean ‘realloc’? Fixes: 8e9bed1493f5 ("dcb: Add a subtool for the DCB APP object") Signed-off-by: Roi Dayan Reviewed-by: Petr Machata Signed-off-by: Stephen Hemminger --- diff --git a/dcb/dcb_app.c b/dcb/dcb_app.c index 7ce80f850..c4816bc29 100644 --- a/dcb/dcb_app.c +++ b/dcb/dcb_app.c @@ -65,8 +65,7 @@ static void dcb_app_table_fini(struct dcb_app_table *tab) static int dcb_app_table_push(struct dcb_app_table *tab, struct dcb_app *app) { - struct dcb_app *apps = reallocarray(tab->apps, tab->n_apps + 1, - sizeof(*tab->apps)); + struct dcb_app *apps = realloc(tab->apps, (tab->n_apps + 1) * sizeof(*tab->apps)); if (apps == NULL) { perror("Cannot allocate APP table");