From f82df02606c0ebb07dcd8646fe201f724b3b8479 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sat, 24 May 2008 08:46:24 +0300 Subject: [PATCH] Use sizeof_array instead of ad-hoc calculation --- ChangeLog | 7 +++++++ dpkg-deb/main.c | 3 ++- dpkg-split/main.c | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5f2806c9..c0927510 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-05-24 Guillem Jover + + * dpkg-deb/main.c: Include . + (setaction): Use sizeof_array instead of ad-hoc calculation. + * dpkg-split/main.c: Include . + (setaction): Use sizeof_array instead of ad-hoc calculation. + 2008-05-24 Guillem Jover * src/trigcmd.c (main): Remove duplicate program name from badusage. diff --git a/dpkg-deb/main.c b/dpkg-deb/main.c index 527bebcb..43991036 100644 --- a/dpkg-deb/main.c +++ b/dpkg-deb/main.c @@ -36,6 +36,7 @@ #include #include +#include #include #include "dpkg-deb.h" @@ -174,7 +175,7 @@ static void setaction(const struct cmdinfo *cip, const char *value) { badusage(_("conflicting actions -%c (--%s) and -%c (--%s)"), cip->oshort, cip->olong, cipaction->oshort, cipaction->olong); cipaction= cip; - assert((int)(cip-cmdinfos) < (int)(sizeof(dofunctions)*sizeof(dofunction*))); + assert((int)(cip - cmdinfos) < (int)(sizeof_array(dofunctions))); action= dofunctions[cip-cmdinfos]; } diff --git a/dpkg-split/main.c b/dpkg-split/main.c index 7eff4b42..da8b9a72 100644 --- a/dpkg-split/main.c +++ b/dpkg-split/main.c @@ -30,6 +30,7 @@ #include #include +#include #include #include "dpkg-split.h" @@ -152,7 +153,7 @@ static void setaction(const struct cmdinfo *cip, const char *value) { badusage(_("conflicting actions -%c (--%s) and -%c (--%s)"), cip->oshort, cip->olong, cipaction->oshort, cipaction->olong); cipaction= cip; - assert((int)(cip-cmdinfos) < (int)(sizeof(dofunctions)*sizeof(dofunction*))); + assert((int)(cip - cmdinfos) < (int)(sizeof_array(dofunctions))); action= dofunctions[cip-cmdinfos]; } -- 2.39.5