mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Janitor project to convert sizeof to ARRAY_LEN macro.
(closes issue #13002) Reported by: caio1982 Patches: janitor_arraylen5.diff uploaded by caio1982 (license 22) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@129045 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -345,7 +345,7 @@ static char *authority_to_str(int authority, struct ast_str **res)
|
||||
char *sep = "";
|
||||
|
||||
(*res)->used = 0;
|
||||
for (i = 0; i < (sizeof(perms) / sizeof(perms[0])) - 1; i++) {
|
||||
for (i = 0; i < ARRAY_LEN(perms) - 1; i++) {
|
||||
if (authority & perms[i].num) {
|
||||
ast_str_append(res, 0, "%s%s", sep, perms[i].label);
|
||||
sep = ",";
|
||||
@@ -387,7 +387,7 @@ static int get_perm(const char *instr)
|
||||
if (!instr)
|
||||
return 0;
|
||||
|
||||
for (x = 0; x < (sizeof(perms) / sizeof(perms[0])); x++) {
|
||||
for (x = 0; x < ARRAY_LEN(perms); x++) {
|
||||
if (ast_instring(instr, perms[x].label, ','))
|
||||
ret |= perms[x].num;
|
||||
}
|
||||
@@ -415,7 +415,7 @@ static int strings_to_mask(const char *string)
|
||||
return 0;
|
||||
if (ast_true(string)) { /* all permissions */
|
||||
int x, ret = 0;
|
||||
for (x = 0; x<sizeof(perms) / sizeof(perms[0]); x++)
|
||||
for (x = 0; x < ARRAY_LEN(perms); x++)
|
||||
ret |= perms[x].num;
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user