Skip to content

Commit

Permalink
treewide: Mark const cases found by cppcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
cdown committed Nov 9, 2024
1 parent f07cb1c commit a911cae
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static int convert_selections(const char *str, void *output) {

_drop_(free) char *inner_str = strdup(str);
expect(inner_str);
char *token = strtok(inner_str, " ");
const char *token = strtok(inner_str, " ");
size_t i;

while (token) {
Expand Down Expand Up @@ -358,7 +358,7 @@ void setup_selections(Display *dpy, struct cm_selections *sels) {
}

enum selection_type
selection_atom_to_selection_type(Atom atom, struct cm_selections *sels) {
selection_atom_to_selection_type(Atom atom, const struct cm_selections *sels) {
for (size_t i = 0; i < CM_SEL_MAX; ++i) {
if (sels[i].selection == atom) {
return i;
Expand All @@ -367,8 +367,8 @@ selection_atom_to_selection_type(Atom atom, struct cm_selections *sels) {
die("Unreachable\n");
}

enum selection_type storage_atom_to_selection_type(Atom atom,
struct cm_selections *sels) {
enum selection_type
storage_atom_to_selection_type(Atom atom, const struct cm_selections *sels) {
for (size_t i = 0; i < CM_SEL_MAX; ++i) {
if (sels[i].storage == atom) {
return i;
Expand Down
4 changes: 2 additions & 2 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ extern const char *prog_name;
struct config _nonnull_ setup(const char *inner_prog_name);
void _nonnull_ setup_selections(Display *dpy, struct cm_selections *sels);
enum selection_type _nonnull_
selection_atom_to_selection_type(Atom atom, struct cm_selections *sels);
selection_atom_to_selection_type(Atom atom, const struct cm_selections *sels);
enum selection_type _nonnull_
storage_atom_to_selection_type(Atom atom, struct cm_selections *sels);
storage_atom_to_selection_type(Atom atom, const struct cm_selections *sels);

int convert_bool(const char *str, void *output);
int convert_positive_int(const char *str, void *output);
Expand Down
2 changes: 1 addition & 1 deletion src/store.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static size_t _must_use_ cs_file_size(size_t nr_snips) {
* @cs: The clip store to operate on
* @file_size: The current size of the file
*/
static int _must_use_ _nonnull_ cs_header_validate(struct clip_store *cs,
static int _must_use_ _nonnull_ cs_header_validate(const struct clip_store *cs,
size_t file_size) {
if (cs->header->nr_snips > cs->header->nr_snips_alloc ||
(cs->header->nr_snips_alloc + 1) * CS_SNIP_SIZE != file_size) {
Expand Down

0 comments on commit a911cae

Please sign in to comment.