diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 698f6d211f65f1e2129783d97185026bbd271c42..0206e221a346ed46d10f4dbda0c02feba6ca2252 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -1422,7 +1422,7 @@ static const char *mbox(int id) "Deleted", "Urgent" }; - return (id >= 0 && id < (sizeof(msgs)/sizeof(msgs[0]))) ? msgs[id] : "Unknown"; + return (id >= 0 && id < ARRAY_LEN(msgs)) ? msgs[id] : "Unknown"; } static void free_user(struct ast_vm_user *vmu) diff --git a/channels/iax2-parser.c b/channels/iax2-parser.c index b9af6fd6e546576f960a80434ba964cf2bdc598c..224a924ced4eeeb6721a35fe48bc00b556b6a5c6 100644 --- a/channels/iax2-parser.c +++ b/channels/iax2-parser.c @@ -533,14 +533,14 @@ void iax_showframe(struct iax_frame *f, struct ast_iax2_full_hdr *fhi, int rx, s sprintf(subclass2, "%c", fh->csub); subclass = subclass2; } else if (fh->type == AST_FRAME_IAX) { - if (fh->csub >= (int)sizeof(iaxs)/(int)sizeof(iaxs[0])) { + if (fh->csub >= ARRAY_LEN(iaxs)) { snprintf(subclass2, sizeof(subclass2), "(%d?)", fh->csub); subclass = subclass2; } else { subclass = iaxs[(int)fh->csub]; } } else if (fh->type == AST_FRAME_CONTROL) { - if (fh->csub >= (int)sizeof(cmds)/(int)sizeof(cmds[0])) { + if (fh->csub >= ARRAY_LEN(cmds)) { snprintf(subclass2, sizeof(subclass2), "(%d?)", fh->csub); subclass = subclass2; } else { diff --git a/doc/janitor-projects.txt b/doc/janitor-projects.txt index b3c1a75dffb7f4e540cfbdb9f881818b68fb6f2b..a43f9c95794562c2c16d87a1bdd3a4a8cc6a4082 100644 --- a/doc/janitor-projects.txt +++ b/doc/janitor-projects.txt @@ -32,11 +32,3 @@ -- Audit all channel/res/app/etc. modules to ensure that they do not register any entrypoints with the Asterisk core until after they are ready to service requests; all config file reading/processing, structure allocation, etc. must be completed before Asterisk is made aware of any services the module offers. -- Ensure that Realtime-enabled modules do not depend on the order of columns returned by the database lookup (example: outboundproxy and host settings in chan_sip). - - -- There are several places in the code where the length of arrays is calculated in-line with sizeof() and division. A common place to find this is in for loops, like this: - - for (i = 0; i < sizeof(array)/sizeof(array[0]); i++) - - There is a macro in utils.h called ARRAY_LEN which should be used instead for readability's sake. - - for (i = 0; i < ARRAY_LEN(array); i++)