diff options
| author | czjstmax <maxwasmailed@proton.me> | 2025-12-19 12:38:58 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-19 12:38:58 +0100 |
| commit | 39ee964261d1b933a3262dce21a5c594d5a0feea (patch) | |
| tree | e12f56d0427cd853a4057d35b5eb5659343123b4 /kat.h | |
| parent | 8135412155c98bcfbcc9851fb4e832b74f905296 (diff) | |
Made functions `static inline` for a possibile performance gain
Diffstat (limited to 'kat.h')
| -rw-r--r-- | kat.h | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -21,7 +21,7 @@ struct kat_api { }; // Creates a file -int katcreate(const char *path) { +static inline int katcreate(const char *path) { FILE *f = fopen(path, "w"); if (!f) return 1; fclose(f); @@ -29,7 +29,7 @@ int katcreate(const char *path) { } // Appends a key=val to file -int katadd(const char *key, const char *val, const char *path) { +static inline int katadd(const char *key, const char *val, const char *path) { FILE *f = fopen(path, "a"); if (f) { fprintf(f, "%s=%s\n", key, val); @@ -40,7 +40,7 @@ int katadd(const char *key, const char *val, const char *path) { } // Appends a comment to file -int kataddcomment(const char *str, const char *path) { +static inline int kataddcomment(const char *str, const char *path) { FILE *f = fopen(path, "a"); if (f) { fprintf(f, "#%s\n", str); @@ -51,7 +51,7 @@ int kataddcomment(const char *str, const char *path) { } // Reads a key from file -int katreadkey(const char *key, const char *path, char *buffer, size_t bufsize) { +static inline int katreadkey(const char *key, const char *path, char *buffer, size_t bufsize) { FILE *f = fopen(path, "r"); if (!f) return 1; @@ -79,7 +79,7 @@ int katreadkey(const char *key, const char *path, char *buffer, size_t bufsize) } // Deletes a key from file -int katdelkey(const char *key, const char *path) { +static inline int katdelkey(const char *key, const char *path) { FILE *f = fopen(path, "r"); if (!f) return 1; @@ -119,7 +119,7 @@ int katdelkey(const char *key, const char *path) { } // Edits a key's value from file -int kateditkey(const char *key, const char *new_val, const char *path) { +static inline int kateditkey(const char *key, const char *new_val, const char *path) { FILE *f = fopen(path, "r"); if (!f) return 1; |