mirror of
https://github.com/SELinuxProject/selinux
synced 2025-02-07 05:11:45 +00:00
libsepol: mark immutable common helper parameter const
Make it more obvious which parameters are read-only and not being modified and allow callers to pass const pointers. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
This commit is contained in:
parent
6359946633
commit
c640af424d
@ -267,12 +267,12 @@ void strs_sort(struct strs *strs)
|
||||
qsort(strs->list, strs->num, sizeof(char *), strs_cmp);
|
||||
}
|
||||
|
||||
unsigned strs_num_items(struct strs *strs)
|
||||
unsigned strs_num_items(const struct strs *strs)
|
||||
{
|
||||
return strs->num;
|
||||
}
|
||||
|
||||
size_t strs_len_items(struct strs *strs)
|
||||
size_t strs_len_items(const struct strs *strs)
|
||||
{
|
||||
unsigned i;
|
||||
size_t len = 0;
|
||||
@ -285,7 +285,7 @@ size_t strs_len_items(struct strs *strs)
|
||||
return len;
|
||||
}
|
||||
|
||||
char *strs_to_str(struct strs *strs)
|
||||
char *strs_to_str(const struct strs *strs)
|
||||
{
|
||||
char *str = NULL;
|
||||
size_t len = 0;
|
||||
@ -327,7 +327,7 @@ exit:
|
||||
return str;
|
||||
}
|
||||
|
||||
void strs_write_each(struct strs *strs, FILE *out)
|
||||
void strs_write_each(const struct strs *strs, FILE *out)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
@ -339,7 +339,7 @@ void strs_write_each(struct strs *strs, FILE *out)
|
||||
}
|
||||
}
|
||||
|
||||
void strs_write_each_indented(struct strs *strs, FILE *out, int indent)
|
||||
void strs_write_each_indented(const struct strs *strs, FILE *out, int indent)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
@ -360,7 +360,7 @@ int hashtab_ordered_to_strs(char *key, void *data, void *args)
|
||||
return strs_add_at_index(strs, key, datum->value-1);
|
||||
}
|
||||
|
||||
int ebitmap_to_strs(struct ebitmap *map, struct strs *strs, char **val_to_name)
|
||||
int ebitmap_to_strs(const struct ebitmap *map, struct strs *strs, char **val_to_name)
|
||||
{
|
||||
struct ebitmap_node *node;
|
||||
uint32_t i;
|
||||
@ -379,7 +379,7 @@ int ebitmap_to_strs(struct ebitmap *map, struct strs *strs, char **val_to_name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *ebitmap_to_str(struct ebitmap *map, char **val_to_name, int sort)
|
||||
char *ebitmap_to_str(const struct ebitmap *map, char **val_to_name, int sort)
|
||||
{
|
||||
struct strs *strs;
|
||||
char *str = NULL;
|
||||
@ -427,7 +427,7 @@ char *strs_stack_pop(struct strs *stack)
|
||||
return strs_remove_last(stack);
|
||||
}
|
||||
|
||||
int strs_stack_empty(struct strs *stack)
|
||||
int strs_stack_empty(const struct strs *stack)
|
||||
{
|
||||
return strs_num_items(stack) == 0;
|
||||
}
|
||||
|
@ -102,19 +102,19 @@ char *strs_remove_last(struct strs *strs);
|
||||
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);
|
||||
char *strs_to_str(struct strs *strs);
|
||||
void strs_write_each(struct strs *strs, FILE *out);
|
||||
void strs_write_each_indented(struct strs *strs, FILE *out, int indent);
|
||||
unsigned strs_num_items(const struct strs *strs);
|
||||
size_t strs_len_items(const struct strs *strs);
|
||||
char *strs_to_str(const struct strs *strs);
|
||||
void strs_write_each(const struct strs *strs, FILE *out);
|
||||
void strs_write_each_indented(const struct strs *strs, FILE *out, int indent);
|
||||
int hashtab_ordered_to_strs(char *key, void *data, void *args);
|
||||
int ebitmap_to_strs(struct ebitmap *map, struct strs *strs, char **val_to_name);
|
||||
char *ebitmap_to_str(struct ebitmap *map, char **val_to_name, int sort);
|
||||
int ebitmap_to_strs(const struct ebitmap *map, struct strs *strs, char **val_to_name);
|
||||
char *ebitmap_to_str(const struct ebitmap *map, char **val_to_name, int sort);
|
||||
|
||||
int strs_stack_init(struct strs **stack);
|
||||
void strs_stack_destroy(struct strs **stack);
|
||||
int strs_stack_push(struct strs *stack, char *s);
|
||||
char *strs_stack_pop(struct strs *stack);
|
||||
int strs_stack_empty(struct strs *stack);
|
||||
int strs_stack_empty(const struct strs *stack);
|
||||
|
||||
int sort_ocontexts(struct policydb *pdb);
|
||||
|
Loading…
Reference in New Issue
Block a user