Remove the typedef for the non-existent type_argument_t.
[cparser] / string_rep.h
index e24b40c..f3a1e6b 100644 (file)
 #ifndef STRING_REP_H
 #define STRING_REP_H
 
-#include <wchar.h>
-
-typedef wchar_t wchar_rep_t;
+#include <stdlib.h>
+#include "unicode.h"
 
 typedef struct string_t {
-       const char *begin;
-       size_t      size;
+       const char *begin; /**< UTF-8 encoded string, the last character is
+                                               * guaranteed to be 0 */
+       size_t      size;  /**< size of string in bytes (not characters) */
 } string_t;
 
-typedef struct wide_string_t {
-       const wchar_rep_t *begin;
-       size_t             size;
-} wide_string_t;
+static inline size_t wstrlen(const string_t *string)
+{
+       size_t      result = 0;
+       const char *p      = string->begin;
+       const char *end    = p + string->size;
+       while (p < end) {
+               read_utf8_char(&p);
+               ++result;
+       }
+       return result;
+}
 
 #endif