allow trim() public function

This commit is contained in:
2026-05-22 22:08:21 -03:00
parent 9bed332fe9
commit d48c8c1c36
2 changed files with 8 additions and 2 deletions

View File

@@ -16,7 +16,7 @@
/* Internal helpers — kept private to this translation unit. */
static int uselesschar(int c);
static void trim(char *s);
/* trim is public (declared in lib11sht.h) */
static void asciify(const char *src, char *dest, size_t dest_size);
static int ulen(unsigned char c);
static float shit11(char *s1, char *s2);
@@ -162,7 +162,7 @@ static int uselesschar(int c)
/* ---------------------------------------------------------------------- */
/* remove leading/trailing whitespace + collapse internal multiple whitespace */
static void trim(char *s)
void trim(char *s)
{
int len, i, j, fin = 0;

View File

@@ -50,4 +50,10 @@ int sequal_full(char *a, char *b, float shold, float *ratio,
*/
int fequal(float a, float b, float delta);
/* String trim: removes leading + trailing whitespace (including UTF-8
* NBSP bytes 0xC2 / 0xA0) AND collapses internal runs of whitespace
* to a single space. Modifies s in place. Caller's buffer must already
* be NUL-terminated. */
void trim(char *s);
#endif /* LIB11SHT_H */