util_string.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* Copyright (c) 2003-2004, Roger Dingledine
  2. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  3. * Copyright (c) 2007-2018, The Tor Project, Inc. */
  4. /* See LICENSE for licensing information */
  5. #ifndef TOR_UTIL_STRING_H
  6. #define TOR_UTIL_STRING_H
  7. #include "orconfig.h"
  8. #include "lib/cc/compat_compiler.h"
  9. #include <stddef.h>
  10. /** Allowable characters in a hexadecimal string. */
  11. #define HEX_CHARACTERS "0123456789ABCDEFabcdef"
  12. void tor_strlower(char *s) ATTR_NONNULL((1));
  13. void tor_strupper(char *s) ATTR_NONNULL((1));
  14. int tor_strisprint(const char *s) ATTR_NONNULL((1));
  15. int tor_strisnonupper(const char *s) ATTR_NONNULL((1));
  16. int tor_strisspace(const char *s);
  17. int strcmp_opt(const char *s1, const char *s2);
  18. int strcmpstart(const char *s1, const char *s2) ATTR_NONNULL((1,2));
  19. int strcmp_len(const char *s1, const char *s2, size_t len) ATTR_NONNULL((1,2));
  20. int strcasecmpstart(const char *s1, const char *s2) ATTR_NONNULL((1,2));
  21. int strcmpend(const char *s1, const char *s2) ATTR_NONNULL((1,2));
  22. int strcasecmpend(const char *s1, const char *s2) ATTR_NONNULL((1,2));
  23. int fast_memcmpstart(const void *mem, size_t memlen, const char *prefix);
  24. void tor_strstrip(char *s, const char *strip) ATTR_NONNULL((1,2));
  25. const char *eat_whitespace(const char *s);
  26. const char *eat_whitespace_eos(const char *s, const char *eos);
  27. const char *eat_whitespace_no_nl(const char *s);
  28. const char *eat_whitespace_eos_no_nl(const char *s, const char *eos);
  29. const char *find_whitespace(const char *s);
  30. const char *find_whitespace_eos(const char *s, const char *eos);
  31. const char *find_str_at_start_of_line(const char *haystack,
  32. const char *needle);
  33. int string_is_C_identifier(const char *string);
  34. #endif /* !defined(TOR_UTIL_STRING_H) */