mirror of
https://github.com/SELinuxProject/selinux
synced 2025-04-29 22:28:02 +00:00
libsepol: use size_t for indexes in strs helpers
Use size_t, as the strs struct uses it for its size member. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
This commit is contained in:
parent
8565e2c5c8
commit
47c3d96e56
@ -159,7 +159,7 @@ int strs_add(struct strs *strs, char *s)
|
|||||||
{
|
{
|
||||||
if (strs->num + 1 > strs->size) {
|
if (strs->num + 1 > strs->size) {
|
||||||
char **new;
|
char **new;
|
||||||
unsigned i = strs->size;
|
size_t i = strs->size;
|
||||||
strs->size *= 2;
|
strs->size *= 2;
|
||||||
new = reallocarray(strs->list, strs->size, sizeof(char *));
|
new = reallocarray(strs->list, strs->size, sizeof(char *));
|
||||||
if (!new) {
|
if (!new) {
|
||||||
@ -212,11 +212,11 @@ char *strs_remove_last(struct strs *strs)
|
|||||||
return strs->list[strs->num];
|
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) {
|
if (index >= strs->size) {
|
||||||
char **new;
|
char **new;
|
||||||
unsigned i = strs->size;
|
size_t i = strs->size;
|
||||||
while (index >= strs->size) {
|
while (index >= strs->size) {
|
||||||
strs->size *= 2;
|
strs->size *= 2;
|
||||||
}
|
}
|
||||||
@ -237,7 +237,7 @@ int strs_add_at_index(struct strs *strs, char *s, unsigned index)
|
|||||||
return 0;
|
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) {
|
if (index >= strs->num) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -99,8 +99,8 @@ int strs_add(struct strs *strs, char *s);
|
|||||||
__attribute__ ((format(printf, 2, 4)))
|
__attribute__ ((format(printf, 2, 4)))
|
||||||
int strs_create_and_add(struct strs *strs, const char *fmt, int num, ...);
|
int strs_create_and_add(struct strs *strs, const char *fmt, int num, ...);
|
||||||
char *strs_remove_last(struct strs *strs);
|
char *strs_remove_last(struct strs *strs);
|
||||||
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);
|
||||||
char *strs_read_at_index(struct strs *strs, unsigned index);
|
char *strs_read_at_index(struct strs *strs, size_t index);
|
||||||
void strs_sort(struct strs *strs);
|
void strs_sort(struct strs *strs);
|
||||||
unsigned strs_num_items(struct strs *strs);
|
unsigned strs_num_items(struct strs *strs);
|
||||||
size_t strs_len_items(struct strs *strs);
|
size_t strs_len_items(struct strs *strs);
|
||||||
|
Loading…
Reference in New Issue
Block a user