sled

Једноставни уређивач текста
git clone https://git.sr.ht/~strahinja/sled
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување 60ae95cfabd52ccccecedc28f979cfeda93b94c7
родитељ 82897e09c458085fa26b59ec16167442bbc8cc80
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Mon, 17 Jun 2024 20:31:11 +0200

Deal with warnings from -Wextra

Diffstat:
Mdraw.c | 30+++++++++++++++---------------
Mdraw.h | 16+++++++---------
Msled.c | 134++++++++++++++++++++++++++++++++++++++-----------------------------------------
Msled.h | 2+-
Mutil.c | 12++++++------
Mutil.h | 11++++++-----
измењених датотека: 6, додавања: 99(+), брисања: 106(-)

diff --git a/draw.c b/draw.c @@ -95,8 +95,7 @@ assign_coord(struct Coord* dest, const struct Coord src) * max_index = the display index up to which the length is calculated */ size_t -buffer_length(const struct DrawState* state, uint32_t* buffer, - const size_t max_index) +buffer_length(uint32_t* buffer, const size_t max_index) { size_t len = 0; uint32_t* pbuf = buffer; @@ -131,8 +130,7 @@ calculate_input_dialog_width(const struct DrawState* state) * max_index = the buffer index up to which the length is calculated */ size_t -display_length(const struct DrawState* state, uint32_t* buffer, - const size_t max_index) +display_length(uint32_t* buffer, const size_t max_index) { size_t len = 0; uint32_t* pbuf = buffer; @@ -233,7 +231,7 @@ draw_help(const struct DrawState* state) strlen(help_title) + 2, w, 1, 1, CENTER, 0, 0, NULL, 0, 0, 0, 0, 0, 0)) return 1; - while (row < LEN(help)) + while ((size_t)row < LEN(help)) { if (draw_string(startx + 1, starty + 1 + row, DLG_FG, DLG_BG, help[row], w - 2, w - 2, 1, 1, LEFT, 0, 1, NULL, 0, @@ -251,8 +249,8 @@ draw_input_dialog(const struct DrawState* state) int startx, endx, starty, endy; int w, h; int maxx, maxy; - size_t len; - size_t dlen = 0; + int len; + int dlen = 0; if (!state) return 1; @@ -277,7 +275,7 @@ draw_input_dialog(const struct DrawState* state) state->input_title, strlen(state->input_title) + 2, w, 1, 1, CENTER, 0, 0, NULL, 0, 0, 0, 0, 0, 0)) return 1; - dlen = display_length(state, state->input, len); + dlen = display_length(state->input, len); if (dlen > state->input_first_shown_column) u32_draw_string(startx + 1, starty + 1, INPUT_EDIT_FG, INPUT_EDIT_BG, state->input, w - 2, w - 2, 1, 1, LEFT, @@ -324,7 +322,7 @@ draw_screen(const struct DrawState* state) max_screen_lines = state->maxy - 1; i = state->first_shown.row; - while ((i < state->rows_count) && (cy < max_screen_lines)) + while (((size_t)i < state->rows_count) && (cy < max_screen_lines)) { current = state->buffer + i; @@ -370,7 +368,7 @@ int draw_status(const struct DrawState* state) { char* buf = NULL; - int seg_size; + size_t seg_size; int current_start = 0; const struct StatusSegment* pseg; @@ -475,15 +473,15 @@ draw_string(const int x, const int y, const uint16_t fg, const uint16_t bg, void format_filename(char* result, size_t result_size, const char* format, - const int seg_size, const struct DrawState* state) + const size_t seg_size, const struct DrawState* state) { char* basename = NULL; - if (!result || seg_size < 2) + if (!result || seg_size < 4) return; basename = strdup(u8_basename(state->filename)); - if (u8_strlen(basename) >= seg_size - 2) + if (u8_strlen(basename) + 2 >= seg_size) { if (state->dirty) basename[seg_size - 4] = 0; @@ -500,9 +498,10 @@ format_filename(char* result, size_t result_size, const char* format, void format_mode(char* result, size_t result_size, const char* format, - const int seg_size, const struct DrawState* state) + const size_t seg_size, const struct DrawState* state) { const char* mode_label = mode_labels[UNKNOWN_MODE]; + UNUSED(seg_size); if (!result) goto format_print; if (IN(state->mode, M_INPUT_NUM)) @@ -528,8 +527,9 @@ format_print: void format_position(char* result, size_t result_size, const char* format, - const int seg_size, const struct DrawState* state) + const size_t seg_size, const struct DrawState* state) { + UNUSED(seg_size); if (!result) return; snprintf(result, result_size, format, state->display_column + 1, diff --git a/draw.h b/draw.h @@ -55,7 +55,7 @@ struct DrawState { char* filename; char* real_filename; /* what symlink points to */ char* backup_filename; - size_t rfn_len; + ssize_t rfn_len; uint32_t* input; uint32_t* search; int chain_dialog; /* show input dialogs in sequence? */ @@ -97,7 +97,7 @@ struct Key { struct StatusSegment { const char* format; - void (*callback)(char*, size_t, const char*, const int, + void (*callback)(char*, size_t, const char*, const size_t, const struct DrawState*); uint16_t fg; uint16_t bg; @@ -105,12 +105,10 @@ struct StatusSegment { }; void assign_coord(struct Coord* dest, const struct Coord src); -size_t buffer_length(const struct DrawState* state, uint32_t* buffer, - const size_t max_index); +size_t buffer_length(uint32_t* buffer, const size_t max_index); int calculate_help_width(const struct DrawState* state); int calculate_input_dialog_width(const struct DrawState* state); -size_t display_length(const struct DrawState* state, uint32_t* buffer, - const size_t max_index); +size_t display_length(uint32_t* buffer, const size_t max_index); int draw(const struct DrawState* state); void draw_box(const int startx, const int endx, const int starty, const int endy, const uint16_t fg, const uint16_t bg); @@ -127,11 +125,11 @@ int draw_string(const int x, const int y, const uint16_t fg, const uint16_t bg, const uint16_t sbg, const int ssi, const int sei, const uint16_t slfg, const uint16_t slbg); void format_filename(char* result, size_t result_size, const char* format, - const int seg_size, const struct DrawState* state); + const size_t seg_size, const struct DrawState* state); void format_mode(char* result, size_t result_size, const char* format, - const int seg_size, const struct DrawState* state); + const size_t seg_size, const struct DrawState* state); void format_position(char* result, size_t result_size, const char* format, - const int seg_size, const struct DrawState* state); + const size_t seg_size, const struct DrawState* state); void free_bufferline(struct BufferLine* bl, const int free_text); void free_drawstate(struct DrawState* state, int skip_paste_free); void init_bufferline(struct BufferLine* bl); diff --git a/sled.c b/sled.c @@ -404,14 +404,8 @@ erase_forward(struct DrawState* state) buffer_line->length--; state->dirty = 1; } - else if (state->coord.row < state->rows_count - 1) - { - // struct BufferLine* current = state->buffer + state->coord.row; - if (state->coord.row + 1 == state->rows_count) - goto skip_join_lines; + else if ((size_t)(state->coord.row + 1) < state->rows_count) simple_join_lines(state); - skip_join_lines:; - } return 0; } @@ -434,7 +428,7 @@ erase_line(struct DrawState* state) current->length = state->buffer[row + 1].length; } free_bufferline(&state->buffer[state->rows_count - 1], 0); - if (state->coord.row == state->rows_count - 1) + if ((size_t)(state->coord.row + 1) == state->rows_count) state->coord.row--; position_to(state, state->coord.row, 0); state->rows_count--; @@ -461,15 +455,14 @@ erase_prev_word(struct DrawState* state) d = state->coord.col - i; - for (int j = i; j < current->length - d; j++) + for (size_t j = i; j + d < current->length; j++) current->text[j] = current->text[j + d]; current->length -= d; current->text[current->length] = 0; state->coord.col = i; - state->display_column - = display_length(state, current->text, state->coord.col); - state->dirty = 1; + state->display_column = display_length(current->text, state->coord.col); + state->dirty = 1; return 0; } @@ -719,7 +712,7 @@ handle_key_event(struct tb_event* ev, struct DrawState* state) if (IN(state->mode, M_INPUT)) { - for (int key = 0; key < LEN(input_dialog_keys); key++) + for (size_t key = 0; key < LEN(input_dialog_keys); key++) { current = input_dialog_keys + key; if (((current->ev.mod == ev->mod) @@ -743,7 +736,7 @@ handle_key_event(struct tb_event* ev, struct DrawState* state) } } - for (int key = 0; key < LEN(top_level_keys); key++) + for (size_t key = 0; key < LEN(top_level_keys); key++) { current = &top_level_keys[key]; if (((current->ev.mod == ev->mod) @@ -759,7 +752,7 @@ handle_key_event(struct tb_event* ev, struct DrawState* state) return; } - for (int key = 0; key < LEN(global_keys); key++) + for (size_t key = 0; key < LEN(global_keys); key++) { current = &global_keys[key]; if (((current->ev.mod == ev->mod) @@ -771,7 +764,7 @@ handle_key_event(struct tb_event* ev, struct DrawState* state) if (IN(state->mode, M_COMMAND)) { - for (int key = 0; key < LEN(command_keys); key++) + for (size_t key = 0; key < LEN(command_keys); key++) { current = &command_keys[key]; if (((current->ev.mod == ev->mod) @@ -785,7 +778,7 @@ handle_key_event(struct tb_event* ev, struct DrawState* state) } else { - for (int key = 0; key < LEN(insert_keys); key++) + for (size_t key = 0; key < LEN(insert_keys); key++) { current = &insert_keys[key]; if (((current->ev.mod == ev->mod) @@ -919,11 +912,11 @@ int input_insert_char(struct DrawState* state, uint32_t ch) { size_t len = u32_strlen(state->input); - if (state->input_column < MAXINPUT - 1) + if (state->input_column + 1 < MAXINPUT) { size_t i = len + 1; int add_null = state->input[state->input_column] == 0; - while (i < MAXINPUT - 2 && i > state->input_column) + while (i + 2 < MAXINPUT && i > (size_t)state->input_column) { state->input[i] = state->input[i - 1]; i--; @@ -973,9 +966,9 @@ input_move_next_word(struct DrawState* state) uint32_t* pline = state->input; size_t len = u32_strlen(state->input); - while (i < len && !u32_is_word_boundary(pline[i], 0)) + while ((size_t)i < len && !u32_is_word_boundary(pline[i], 0)) i++; - while (i < len && u32_is_word_boundary(pline[i], 0)) + while ((size_t)i < len && u32_is_word_boundary(pline[i], 0)) i++; input_position_to(state, i); return 0; @@ -1018,10 +1011,10 @@ input_position_to(struct DrawState* state, const int column) size_t len = u32_strlen(state->input); state->input_column = column; - if (state->input_column > len) + if ((size_t)state->input_column > len) state->input_column = len; state->input_display_column - = display_length(state, state->input, state->input_column); + = display_length(state->input, state->input_column); if (state->input_first_shown_column > state->input_display_column) state->input_first_shown_column = state->input_display_column; if (state->input_first_shown_column + (state->input_dialog_width - 4) @@ -1041,7 +1034,8 @@ insert_char(struct DrawState* state, uint32_t ch) uint32_t* ptext = NULL; ENSURE_SIZE(state->buffer[state->coord.row].text, ptext, - state->buffer[state->coord.row].size, state->coord.col + 2, + state->buffer[state->coord.row].size, + (size_t)(state->coord.col + 2), state->coord.col + LINE_ALLOC_DELTA, insert_char_error, uint32_t); @@ -1059,13 +1053,13 @@ insert_char(struct DrawState* state, uint32_t ch) i = len + 1; if (!IN(state->mode, M_OVERWRITE)) - while (i < size - 1 && i > state->coord.col) + while (i + 1 < size && i > (size_t)state->coord.col) { buffer_line->text[i] = buffer_line->text[i - 1]; i--; } buffer_line->text[state->coord.col] = ch; - if (state->coord.col == len || !IN(state->mode, M_OVERWRITE)) + if ((size_t)state->coord.col == len || !IN(state->mode, M_OVERWRITE)) buffer_line->length++; position_to(state, state->coord.row, state->coord.col + 1); if (add_null) @@ -1076,8 +1070,7 @@ insert_char(struct DrawState* state, uint32_t ch) { int saved_column = state->coord.col; buffer_line = state->buffer + state->coord.row; - state->coord.col - = buffer_length(state, buffer_line->text, WRAP_WIDTH); + state->coord.col = buffer_length(buffer_line->text, WRAP_WIDTH); while (state->coord.col > 0 && !u32_is_word_boundary(buffer_line->text[state->coord.col - 1], @@ -1120,8 +1113,7 @@ insert_line(struct DrawState* state) { int saved_column = state->coord.col; buffer_line = state->buffer + state->coord.row; - state->coord.col - = buffer_length(state, buffer_line->text, WRAP_WIDTH); + state->coord.col = buffer_length(buffer_line->text, WRAP_WIDTH); while (state->coord.col > 0 && !u32_is_word_boundary(buffer_line->text[state->coord.col - 1], @@ -1185,7 +1177,7 @@ join_lines(struct DrawState* state) ser = state->coord.row; } - if (ssr == state->rows_count - 1) + if ((size_t)(ssr + 1) == state->rows_count) return 0; for (int row = ssr; row <= ser; row++) @@ -1209,8 +1201,8 @@ join_lines(struct DrawState* state) } else state->coord.col = current->length; - state->display_column = display_length(state, current->text, - state->coord.col); + state->display_column + = display_length(current->text, state->coord.col); simple_join_lines(state); } @@ -1225,7 +1217,7 @@ join_lines_error: } int -load_file(struct DrawState* state, long* lineno, long* col) +load_file(struct DrawState* state) { struct BufferLine* newchunk = NULL; struct BufferLine* line = NULL; @@ -1369,9 +1361,9 @@ move_next_word(struct DrawState* state) uint32_t* pline = state->buffer[state->coord.row].text; size_t len = state->buffer[state->coord.row].length; - while (i < len && !u32_is_word_boundary(pline[i], 0)) + while ((size_t)i < len && !u32_is_word_boundary(pline[i], 0)) i++; - while (i < len && u32_is_word_boundary(pline[i], 0)) + while ((size_t)i < len && u32_is_word_boundary(pline[i], 0)) i++; position_to(state, state->coord.row, i); return 0; @@ -1380,7 +1372,7 @@ move_next_word(struct DrawState* state) int move_page_down(struct DrawState* state) { - if (state->coord.row + state->maxy - 2 < state->rows_count) + if ((size_t)(state->coord.row + state->maxy) < state->rows_count + 2) position_to(state, state->coord.row + state->maxy - 2, state->coord.col); else @@ -1426,11 +1418,12 @@ move_right(struct DrawState* state) int move_screen_bottom(struct DrawState* state) { - if (state->rows_count < state->maxy - 2) + if (state->rows_count + 2 < (size_t)state->maxy) position_to(state, state->rows_count - 1, state->coord.col); else { - if (state->first_shown.row + state->maxy - 2 < state->rows_count) + if ((size_t)(state->first_shown.row + state->maxy) + < state->rows_count + 2) position_to(state, state->first_shown.row + state->maxy - 2, state->coord.col); @@ -1441,12 +1434,12 @@ move_screen_bottom(struct DrawState* state) int move_screen_middle(struct DrawState* state) { - if (state->rows_count < state->maxy - 2) + if (state->rows_count + 2 < (size_t)state->maxy) position_to(state, state->rows_count / 2, state->coord.col); else { int row = state->first_shown.row + (state->maxy - 2) / 2; - if (state->rows_count - row < (state->maxy - 2) / 2) + if (state->rows_count < (size_t)(row + (state->maxy - 2) / 2)) row = state->rows_count - (state->maxy - 2) / 2; position_to(state, row, state->coord.col); } @@ -1497,14 +1490,14 @@ next_match(struct DrawState* state) { current = state->buffer + row; found = current->text; - if (row == state->coord.row) + if (row == (size_t)state->coord.row) found += state->coord.col + 1; found = u32_strstr(found, state->search); if (found) { idelta = found - (const uint32_t*)current->text; state->saved_column - = display_length(state, current->text, idelta); + = display_length(current->text, idelta); if (*current->text) { position_to(state, row, idelta); @@ -1646,8 +1639,10 @@ paste_from_paste(struct DrawState* state) line->length = u32_strlen(line->text); newpos.col = state->paste[state->paste_count - 1].length; newpos.row += state->paste_count - 1; - state->saved_column = display_length(state, - state->paste[state->paste_count - 1].text, newpos.col); + state->saved_column + = display_length(state->paste[state->paste_count - 1] + .text, + newpos.col); } position_to(state, newpos.row, newpos.col); @@ -1671,7 +1666,7 @@ position_to(struct DrawState* state, const int row, const int column) if (row != state->coord.row) { state->coord.row = row; - if (state->coord.row > state->rows_count - 1) + if ((size_t)(state->coord.row + 1) > state->rows_count) state->coord.row = state->rows_count - 1; if (state->first_shown.row > state->coord.row) state->first_shown.row = state->coord.row; @@ -1685,18 +1680,19 @@ position_to(struct DrawState* state, const int row, const int column) state->coord.col = column; } else - state->coord.col = buffer_length(state, - state->buffer[state->coord.row].text, - state->saved_column); + state->coord.col + = buffer_length(state->buffer[state->coord.row] + .text, + state->saved_column); if (state->coord.col < 0) state->coord.col = 0; else if (state->coord.col > (int)state->buffer[state->coord.row].length) state->coord.col = state->buffer[state->coord.row].length; - dlen = display_length(state, - state->buffer[state->coord.row].text, state->coord.col); - if (dlen < state->saved_column) + dlen = display_length(state->buffer[state->coord.row].text, + state->coord.col); + if (dlen < (size_t)state->saved_column) state->display_column = dlen; else state->display_column = state->saved_column; @@ -1715,10 +1711,10 @@ position_to(struct DrawState* state, const int row, const int column) else state->coord.col = 0; } - else if (state->coord.col - > (int)state->buffer[state->coord.row].length) + else if ((size_t)state->coord.col + > state->buffer[state->coord.row].length) { - if (state->coord.row + 1 < state->rows_count) + if ((size_t)(state->coord.row + 1) < state->rows_count) { state->coord.row++; state->coord.col = 0; @@ -1727,9 +1723,10 @@ position_to(struct DrawState* state, const int row, const int column) state->coord.col = state->buffer[state->coord.row].length; } - state->display_column = display_length(state, - state->buffer[state->coord.row].text, state->coord.col); - state->saved_column = state->display_column; + state->display_column + = display_length(state->buffer[state->coord.row].text, + state->coord.col); + state->saved_column = state->display_column; } if (state->first_shown.col > state->display_column) state->first_shown.col = state->display_column; @@ -1752,7 +1749,7 @@ position_to_selection_start(struct DrawState* state) get_selection(&ssr, &ssc, NULL, NULL, state); state->saved_column - = display_length(state, state->buffer[ssr].text, ssc); + = display_length(state->buffer[ssr].text, ssc); position_to(state, ssr, ssc); state->saved_column = state->display_column; } @@ -1780,7 +1777,7 @@ prev_match(struct DrawState* state) found = current->text; if (!found) return 0; - if (row == state->coord.row) + if (row == (size_t)state->coord.row) found += state->coord.col; else found += current->length; @@ -1792,7 +1789,7 @@ prev_match(struct DrawState* state) { idelta = found - current->text; state->saved_column - = display_length(state, current->text, idelta); + = display_length(current->text, idelta); if (*current->text) { position_to(state, row, idelta); @@ -1853,8 +1850,6 @@ reread_callback(struct DrawState* state, struct tb_event* ev) int reread_file(struct DrawState* state) { - long lineno = 1; - long col = 1; int result; char* temp = NULL; @@ -1862,7 +1857,7 @@ reread_file(struct DrawState* state) init_drawstate(state, state->error, state->action, state->filename, state->prompt, 1); - result = load_file(state, &lineno, &col); + result = load_file(state); switch (result) { case LOAD_ERR_CANT_ALLOC: @@ -2244,7 +2239,8 @@ simple_insert_line(struct DrawState* state) } } state->rows_count++; - for (size_t i = state->rows_count - 1; i > state->coord.row + 1; i--) + for (size_t i = state->rows_count - 1; + i > (size_t)(state->coord.row + 1); i--) { U32_SAFE_COPY(state->buffer[i].text, ptext, state->buffer[i].size, state->buffer[i - 1].text, @@ -2362,7 +2358,7 @@ simple_yank(struct DrawState* state) if (state->paste_count == 1) { U32_SAFE_COPY(state->paste[0].text, ptext, state->paste[0].size, - state->buffer[ssr].text + ssc, sec - ssc + 1, + state->buffer[ssr].text + ssc, (size_t)(sec - ssc + 1), simple_yank_alloc_error); state->paste[0].length = sec - ssc; } @@ -2388,7 +2384,7 @@ simple_yank(struct DrawState* state) U32_SAFE_COPY(state->paste[state->paste_count - 1].text, ptext, state->paste[state->paste_count - 1].size, - state->buffer[ser].text, sec + 1, + state->buffer[ser].text, (size_t)(sec + 1), simple_yank_alloc_error); state->paste[state->paste_count - 1].length = sec; } @@ -2504,8 +2500,6 @@ main(int argc, char** argv) char* filename = NULL; size_t filename_size = 0; struct stat st; - long lineno = 1; - long col = 1; int result; int dir_access; int dir_access_errno; @@ -2794,7 +2788,7 @@ main(int argc, char** argv) && access(state.real_filename, F_OK | R_OK | W_OK) == -1) goto file_error; - result = load_file(&state, &lineno, &col); + result = load_file(&state); switch (result) { case LOAD_ERR_CANT_ALLOC: diff --git a/sled.h b/sled.h @@ -44,7 +44,7 @@ int insert_line(struct DrawState* state); int insert_space(struct DrawState* state); int insert_tab(struct DrawState* state); int join_lines(struct DrawState* state); -int load_file(struct DrawState* dstate, long* lineno, long* col); +int load_file(struct DrawState* dstate); int move_bottom(struct DrawState* state); int move_down(struct DrawState* state); int move_end(struct DrawState* state); diff --git a/util.c b/util.c @@ -75,7 +75,7 @@ u32_memccpy(uint32_t* dst, const uint32_t* src, uint32_t c, size_t len) /* len is the max length of src in bytes */ uint32_t* -u32_u8_memccpy(uint32_t* dst, const char* src, char c, size_t len) +u32_u8_memccpy(uint32_t* dst, const char* src, uint32_t c, size_t len) { size_t copied = 0; size_t u8_len; @@ -156,7 +156,7 @@ u32_strrstr(const uint32_t* haystack, const uint32_t* needle, size_t needle_len = u32_strlen(needle); const uint32_t* ph; - if (needle_len > haystack_tail - haystack) + if (needle_len > (size_t)(haystack_tail - haystack)) return NULL; ph = haystack_tail - needle_len; @@ -186,14 +186,14 @@ u32_strchr(const uint32_t* haystack, const uint32_t needle) return NULL; } -const int +int is_word_boundary(const char ch, const int strictly_whitespace) { return strictly_whitespace ? strchr(" \v\t", ch) != NULL : strchr(" \v\t()[]{},.;:/\\", ch) != NULL; } -const int +int u32_is_word_boundary(const uint32_t ch, const int strictly_whitespace) { return strictly_whitespace @@ -201,7 +201,7 @@ u32_is_word_boundary(const uint32_t ch, const int strictly_whitespace) : u32_strchr((uint32_t*)L" \v\t()[]{},.;:/\\", ch) != NULL; } -const int +int starts_with(const char* s, const char* with) { while (*s && *s == *with) @@ -214,7 +214,7 @@ starts_with(const char* s, const char* with) return *with == 0; } -const int +int u32_starts_with(const uint32_t* s, const uint32_t* with) { while (*s && *s == *with) diff --git a/util.h b/util.h @@ -13,6 +13,7 @@ #define MIN(a, b) ((a < b) ? (a) : (b)) #define SET(v, c) do { (v) |= (c); } while(0) #define TOGGLE(v, c) do { (v) ^= (c); } while(0) +#define UNUSED(x) ((void)(x)) /* clang-format on */ #define MEMCCPY(to, from, tolen, temp) \ @@ -119,15 +120,15 @@ size_t u8_string_to_unicode(uint32_t* us, const char* s, const size_t max); size_t unicode_string_to_u8(char* s, const uint32_t* us, const size_t max); uint32_t* u32_memccpy(uint32_t* dst, const uint32_t* src, uint32_t c, size_t len); -uint32_t* u32_u8_memccpy(uint32_t* dst, const char* src, char c, size_t len); +uint32_t* u32_u8_memccpy(uint32_t* dst, const char* src, uint32_t c, size_t len); size_t u8_strlen(const char* s); size_t u32_strlen(const uint32_t* s); const uint32_t* u32_strstr(const uint32_t* haystack, const uint32_t* needle); const uint32_t* u32_strrstr(const uint32_t* haystack, const uint32_t* needle, const uint32_t* haystack_tail); const uint32_t* u32_strchr(const uint32_t* haystack, const uint32_t needle); -const int is_word_boundary(const char ch, const int strictly_whitespace); -const int u32_is_word_boundary(const uint32_t ch, const int strictly_whitespace); -const int starts_with(const char* s, const char* with); -const int u32_starts_with(const uint32_t* s, const uint32_t* with); +int is_word_boundary(const char ch, const int strictly_whitespace); +int u32_is_word_boundary(const uint32_t ch, const int strictly_whitespace); +int starts_with(const char* s, const char* with); +int u32_starts_with(const uint32_t* s, const uint32_t* with); const char* u8_basename(const char* path);