syntax: use const on copy_id_list() params,vars

This commit is contained in:
Jan Edmund Lazo 2018-07-26 11:28:05 -04:00
parent ef3cbd91cb
commit e6993f2491

View File

@ -5385,20 +5385,18 @@ get_id_list(
/*
* Make a copy of an ID list.
*/
static short *copy_id_list(short *list)
static int16_t *copy_id_list(const int16_t *const list)
{
int len;
int count;
short *retval;
if (list == NULL)
if (list == NULL) {
return NULL;
}
for (count = 0; list[count]; ++count)
;
len = (count + 1) * sizeof(short);
retval = xmalloc(len);
memmove(retval, list, (size_t)len);
int count;
for (count = 0; list[count]; count++) {
}
const size_t len = (count + 1) * sizeof(int16_t);
int16_t *const retval = xmalloc(len);
memmove(retval, list, len);
return retval;
}