lucy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Wellnhofer <>
Subject [lucy-dev] Clownfish String API
Date Wed, 07 Oct 2015 11:10:49 GMT

here are my condensed thoughts on cleaning up the Clownfish String API:


- Rename `new_stack_string` to `init_stack_string`.
- Make all `new_*`, `init_wrap_*` functions public except:
   - `init_stack_string` (only called from macros)
- Remove `Cat_Utf8` and `Cat_Trusted_Utf8`?
   Callers should probably use CharBufs instead.
   Only keep `Cat`.
- Remove underused `Swap_Chars`.
   Maybe add a `Replace` method instead.
- Make stack strings public?
- Add macro to create stack string from null-terminated UTF-8
   without passing the string size:
       String *str = SSTR_WRAP_C("A string.");
- Make `Code_Point_*` return special value instead of 0
   if outside the string.
- Make `Find` return a size_t.
   Requires special value for "not found".
- Make all methods public except:
   - `Is_Copy_On_IncRef`
   - `Hash_Sum`


- Rename StrIter_substring to Str_new_from_iter?
- Make `Starts_With`, `Ends_With` skip over strings?
   I think this better matches current usage patterns.
- Find better names for `Skip_{Next|Prev}_Whitespace`?
- Make all methods public.


View raw message