2

The question is self-explanatory. I'm using the C API.

dan_waterworth
  • 6,261
  • 1
  • 30
  • 41

3 Answers3

2

No, but it's easy to implement. It's just:

UChar *u_strdup(UChar *in) {
    uint32_t len = u_strlen(in) + 1;
    UChar *result = malloc(sizeof(UChar) * len);
    u_memcpy(result, in, len);
    return result;
}
dan_waterworth
  • 6,261
  • 1
  • 30
  • 41
  • 1
    @Steve-o: `memdup` is not a standard function that I've ever heard of. – Thanatos Mar 23 '11 at 15:19
  • Oops, ok looks like I was confusing with [`g_memdup`](http://library.gnome.org/devel/glib/unstable/glib-Memory-Allocation.html#g-memdup) in glib. – Steve-o Mar 24 '11 at 03:12
1

Check out _strdup, _wcsdup, _mbsdup. _wcsdup and _mbsdup are wide and multi byte versions of strdup.

Rob Kielty
  • 7,958
  • 8
  • 39
  • 51
Chris
  • 11
  • 1
1

There isn't, but you could request one and file a bug.

However, ICU typically doesn't return memory the caller owns- it uses its own wrapped malloc/free functions and defines a custom deleter on objects. So, this would be quite different.

Steven R. Loomis
  • 4,228
  • 28
  • 39