Skip to content

Commit

Permalink
libsepol: use size_t for indexes in strs helpers
Browse files Browse the repository at this point in the history
Use size_t, as the strs struct uses it for its size member.

Signed-off-by: Christian Göttsche <[email protected]>
  • Loading branch information
cgzones committed Oct 9, 2021
1 parent be69762 commit b8c2ff2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions libsepol/src/kernel_to_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,11 @@ char *strs_remove_last(struct strs *strs)
return strs->list[strs->num];
}

int strs_add_at_index(struct strs *strs, char *s, unsigned index)
int strs_add_at_index(struct strs *strs, char *s, size_t index)
{
if (index >= strs->size) {
char **new;
unsigned i = strs->size;
size_t i = strs->size;
while (index >= strs->size) {
strs->size *= 2;
}
Expand All @@ -237,7 +237,7 @@ int strs_add_at_index(struct strs *strs, char *s, unsigned index)
return 0;
}

char *strs_read_at_index(struct strs *strs, unsigned index)
char *strs_read_at_index(struct strs *strs, size_t index)
{
if (index >= strs->num) {
return NULL;
Expand Down
4 changes: 2 additions & 2 deletions libsepol/src/kernel_to_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ int strs_add(struct strs *strs, char *s);
__attribute__ ((format(printf, 2, 4)))
int strs_create_and_add(struct strs *strs, const char *fmt, int num, ...);
char *strs_remove_last(struct strs *strs);
int strs_add_at_index(struct strs *strs, char *s, unsigned index);
char *strs_read_at_index(struct strs *strs, unsigned index);
int strs_add_at_index(struct strs *strs, char *s, size_t index);
char *strs_read_at_index(struct strs *strs, size_t index);
void strs_sort(struct strs *strs);
unsigned strs_num_items(struct strs *strs);
size_t strs_len_items(struct strs *strs);
Expand Down

0 comments on commit b8c2ff2

Please sign in to comment.