|
57 | 57 | #include <ICU/unicode/ustring.h> |
58 | 58 | #include <ICU/unicode/utypes.h> |
59 | 59 | #include <ICU/unicode/ucnv.h> |
60 | | -#ifdef USE_UNORM2 |
| 60 | +#ifdef ICU6x |
61 | 61 | #include <ICU/unicode/unorm2.h> |
62 | 62 | #else |
63 | 63 | #include <ICU/unicode/unorm.h> |
|
67 | 67 | #include <unicode/ustring.h> |
68 | 68 | #include <unicode/utypes.h> |
69 | 69 | #include <unicode/ucnv.h> |
70 | | -#ifdef USE_UNORM2 |
| 70 | +#ifdef ICU6x |
71 | 71 | #include <unicode/unorm2.h> |
72 | 72 | #else |
73 | 73 | #include <unicode/unorm.h> |
@@ -96,21 +96,6 @@ int _pathname_utf8_to_system_icu(const char *src, char **dest); |
96 | 96 | int _pathname_normalize_utf8_nfd_icu(const char *src, char **dest); |
97 | 97 |
|
98 | 98 |
|
99 | | -/* |
100 | | - * On Visual Studio, free() gets stuck when you use it with an allocated pointer like all these methods above. |
101 | | - * This method it is to reallocate the memory and then free it, it was easier than try to clean up this horrible code. |
102 | | - * Seriously, what was the purpose of having a pointer of pointers if you use it all the time like a single pointer? - GPV - |
103 | | - * @param ptr, a useless allocated pointer. |
104 | | - */ |
105 | | -static void freeUselessAllocatedPointer(UChar** ptr) |
106 | | -{ |
107 | | - if (*ptr == NULL) return; |
108 | | - *ptr = realloc(*ptr, 1); |
109 | | - free(*ptr); |
110 | | - *ptr = NULL; |
111 | | -} |
112 | | - |
113 | | - |
114 | 99 | /** |
115 | 100 | * Convert a path name in the system locale to the canonical LTFS form (UTF-8, NFC). |
116 | 101 | * @param name file, directory, or xattr name to format |
@@ -491,13 +476,13 @@ int _pathname_format_icu(const char *src, char **dest, bool validate, bool allow |
491 | 476 | /* normalize */ |
492 | 477 | ret = _pathname_normalize_nfc_icu(utf16_name, &utf16_name_norm); |
493 | 478 | if (utf16_name != utf16_name_norm) |
494 | | - freeUselessAllocatedPointer(&utf16_name); |
| 479 | + free(utf16_name); |
495 | 480 | if (ret < 0) |
496 | 481 | return ret; |
497 | 482 |
|
498 | 483 | /* convert to UTF-8 */ |
499 | 484 | ret = _pathname_utf16_to_utf8_icu(utf16_name_norm, dest); |
500 | | - freeUselessAllocatedPointer(&utf16_name_norm); |
| 485 | + free(utf16_name_norm); |
501 | 486 | if (ret < 0) |
502 | 487 | return ret; |
503 | 488 |
|
|
0 commit comments