|
29 | 29 | #include <signal.h> |
30 | 30 | #include <sys/timerfd.h> |
31 | 31 | #include <sys/sendfile.h> |
| 32 | +#include <wchar.h> |
32 | 33 |
|
33 | 34 | int _ribified_socket(int domain, int type, int protocol) { |
34 | 35 | int sockfd = socket(domain, type | SOCK_NONBLOCK, protocol); |
@@ -223,15 +224,28 @@ char *_ribified_strdup(const char *s) { |
223 | 224 | return mem; |
224 | 225 | } |
225 | 226 |
|
| 227 | +char *_ribified_wcsdup(const wchar_t *s) { |
| 228 | + size_t l = (wcslen(s) + 1) * sizeof(wchar_t); |
| 229 | + char *mem = _ribified_malloc(l); |
| 230 | + memcpy(mem, s, l); |
| 231 | + return mem; |
| 232 | +} |
| 233 | + |
| 234 | +size_t _ribified_malloc_usable_size(void *ptr) { |
| 235 | + return *(uint32_t *)(ptr - sizeof(uint32_t)); |
| 236 | +} |
| 237 | + |
226 | 238 | int _ribified_close(int fd) { |
227 | 239 | return ribs_close(fd); |
228 | 240 | } |
229 | 241 |
|
230 | 242 | void *ribify_malloc(size_t size) __attribute__ ((weak, alias("_ribified_malloc"))); |
| 243 | +size_t ribify_malloc_usable_size(void *ptr) __attribute__ ((weak, alias("_ribified_malloc_usable_size"))); |
231 | 244 | void ribify_free(void *ptr) __attribute__ ((weak, alias("_ribified_free"))); |
232 | 245 | void *ribify_calloc(size_t nmemb, size_t size) __attribute__ ((weak, alias("_ribified_calloc"))); |
233 | 246 | void *ribify_realloc(void *ptr, size_t size) __attribute__ ((weak, alias("_ribified_realloc"))); |
234 | 247 | char *ribify_strdup(const char *s) __attribute__ ((weak, alias("_ribified_strdup"))); |
| 248 | +char *ribify_wcsdup(const wchar_t *s) __attribute__ ((weak, alias("_ribified_wcsdup"))); |
235 | 249 |
|
236 | 250 | #ifdef UGLY_GETADDRINFO_WORKAROUND |
237 | 251 | int _ribified_getaddrinfo(const char *node, const char *service, |
|
0 commit comments