sparser

Simple parser — extract URLs from text files
git clone git clone https://git.krisyotam.com/krisyotam/sparser.git
Log | Files | Refs | LICENSE

util.h (526B)


      1 /* See LICENSE file for copyright and license details. */
      2 
      3 #ifndef UTIL_H
      4 #define UTIL_H
      5 
      6 #include <stddef.h>
      7 
      8 /* Memory allocation with error handling */
      9 void *xmalloc(size_t size);
     10 void *xrealloc(void *ptr, size_t size);
     11 char *xstrdup(const char *s);
     12 
     13 /* String utilities */
     14 char *str_trim(char *str);
     15 int str_starts_with(const char *str, const char *prefix);
     16 int str_ends_with(const char *str, const char *suffix);
     17 
     18 /* Error handling */
     19 void die(const char *fmt, ...);
     20 void warn(const char *fmt, ...);
     21 
     22 #endif /* UTIL_H */