woboq / tr

Translation tools for rust
57 stars 9 forks source link

Suggestion: use gettext-sys directly to avoid allocations #18

Open ajtribick opened 1 year ago

ajtribick commented 1 year ago

The wrapper functions in gettext-rs have to allocate CStrings on each call due to the interface of the underlying C library.

It may be interesting to use something like what the cstr! macro in the cstr crate does to append the trailing zero byte at compile time and pass the result directly to the gettext-sys functions, avoiding the intermediate allocation.

ogoffart commented 1 year ago

yes, we could implement such things with a feature flag.