text: #ifndef CCAST_TYPES_STRV_H
  #define CCAST_TYPES_STRV_H
  
  #include <stdbool.h>
  #include <stdlib.h>
  #include <string.h>
  
  #include <cedilla/header.h>
  
  BEGIN_C_DECLS
  
  
  NONNULL WARN_UNUSED_RESULT READONLY_(1, 3) READONLY_(2)
  inline int strvnlfind (
      const char * const * restrict sv, const char * restrict key, size_t nmemb) {
    for (unsigned int i = 0; nmemb == 0 ? sv[i] != NULL : i < nmemb; i++) {
      if (strcmp(sv[i], key) == 0) {
        return i;
      }
    }
    return -1;
  }
  
  #define strvlfind(sv, key) strvnlfind(sv, key, 0)
  #define strvalfind(sv, key) strvnlfind(sv, key, (sizeof(sv) / sizeof(sv[0])))
  
  NONNULL
  inline void strvsort (char **self) {
    unsigned int size;
    for (size = 0; self[size] != NULL; size++) { }
    qsort(self, size, sizeof(char *),
          (int (*)(const void *, const void *)) strcmp);
  }
  
  NONNULL PURE READONLY_(1) READONLY_(2)
  inline int strvcmp (const char * const *self, const char * const *other) {
    unsigned int i;
    for (i = 0; self[i] != NULL && other[i] != NULL; i++) {
      return_nonzero (strcmp(self[i], other[i]));
    }
    return cmp(self[i], other[i]);
  }
  
  NONNULL_AT(1, 2, 3) WARN_UNUSED_RESULT READONLY_(1) READONLY_(4)
  inline int strvtostring_full (
      const char * const *self, struct SizedArray * restrict str,
      const char *delim) {
    for (unsigned int i = 0; self[i] != NULL; i++) {
      if (i != 0) {
        return_nonzero (SizedArray_cat(str, delim));
      }
      return_nonzero (SizedArray_cat(str, self[i]));
    }
    return 0;
  }
  
  NONNULL WARN_UNUSED_RESULT READONLY_(1)
  inline int strvtostring (
      const char * const *self, struct SizedArray * restrict str) {
    return strvtostring_full(self, dest, len, ", ");
  }
  
  inline void strvfree (char **sv) {
    if (sv == NULL) {
      return;
    }
    for (unsigned int i = 0; sv[i] != NULL; i++) {
      promise (sv[i] != sv[i + 1]);
      free(sv[i]);
    }
    free(sv);
  }
  
  NONNULL MALLOC READONLY_(1)
  char **strvdup (const char * const *s);
  NONNULL_AT(1) MALLOC READONLY_(1) READONLY_(2)
  char **strvsplit (
    const char * restrict s, const char * restrict delim, bool strip);
  
  
  END_C_DECLS
  
  #endif /* CCAST_TYPES_STRV_H */
  