CString.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* vim: set expandtab ts=4 sw=4: */
  2. /*
  3. * You may redistribute this program and/or modify it under the terms of
  4. * the GNU General Public License as published by the Free Software Foundation,
  5. * either version 3 of the License, or (at your option) any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  14. */
  15. #ifndef CString_H
  16. #define CString_H
  17. #include "memory/Allocator.h"
  18. #include "util/Gcc.h"
  19. #include "util/Linker.h"
  20. Linker_require("util/CString.c");
  21. #include <stddef.h> // size_t
  22. Gcc_PURE
  23. Gcc_NONNULL(1)
  24. unsigned long CString_strlen(const char* str);
  25. Gcc_PURE
  26. Gcc_NONNULL(1,2)
  27. int CString_strcmp(const char* a, const char* b);
  28. Gcc_PURE
  29. Gcc_NONNULL(1,2)
  30. int CString_strncmp(const char* a, const char *b, size_t n);
  31. Gcc_PURE
  32. Gcc_NONNULL(1)
  33. char* CString_strchr(const char *a, int b);
  34. Gcc_PURE
  35. Gcc_NONNULL(1)
  36. char* CString_strrchr(const char *a, int b);
  37. Gcc_PURE
  38. int CString_strcasecmp(const char *a, const char *b);
  39. /** strstr(haystack, needle); */
  40. Gcc_PURE
  41. Gcc_NONNULL(1,2)
  42. char* CString_strstr(const char* a, const char* b);
  43. Gcc_NONNULL(1,2)
  44. char* CString_strcpy(char* restrict dest, const char* restrict src);
  45. Gcc_NONNULL(1,2)
  46. char* CString_safeStrncpy(char* restrict dest, const char *restrict src, size_t n);
  47. char* CString_strdup(const char* string, struct Allocator* alloc);
  48. #endif