Change char type to c8 in Str8 functions

This commit is contained in:
Abdelrahman Said 2024-10-17 00:13:35 +01:00
parent abf9b09495
commit 76c3b02e45
2 changed files with 7 additions and 6 deletions

View File

@ -1,17 +1,18 @@
#include "str8.h"
#include "aliases.h"
char wapp_str8_get(const Str8 *str, u64 index) {
c8 wapp_str8_get(const Str8 *str, u64 index) {
if (index >= str->size) {
return '\0';
}
return (char)(str->buf[index]);
return str->buf[index];
}
void wapp_str8_set(Str8 *str, u64 index, char c) {
void wapp_str8_set(Str8 *str, u64 index, c8 c) {
if (index >= str->size) {
return;
}
str->buf[index] = (c8)c;
str->buf[index] = c;
}

View File

@ -23,8 +23,8 @@ struct str8 {
.size = sizeof(STRING) - 1, \
.buf = memcpy(&((c8 [sizeof(STRING)]){0}), STRING, sizeof(STRING))})
char wapp_str8_get(const Str8 *str, u64 index);
void wapp_str8_set(Str8 *str, u64 index, char c);
c8 wapp_str8_get(const Str8 *str, u64 index);
void wapp_str8_set(Str8 *str, u64 index, c8 c);
#ifdef __cplusplus
END_C_LINKAGE