Skip to content

Commit a1c429a

Browse files
committed
rename DLLEXPORT to UTF8PROC_DLLEXPORT to prevent conflicts with other header files that define DLLEXPORT
1 parent 0528e9c commit a1c429a

File tree

2 files changed

+42
-42
lines changed

2 files changed

+42
-42
lines changed

utf8proc.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#include "utf8proc_data.c"
4545

4646

47-
DLLEXPORT const int8_t utf8proc_utf8class[256] = {
47+
UTF8PROC_DLLEXPORT const int8_t utf8proc_utf8class[256] = {
4848
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4949
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
5050
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -87,11 +87,11 @@ DLLEXPORT const int8_t utf8proc_utf8class[256] = {
8787
be different, being based on ABI compatibility.): */
8888
#define STRINGIZEx(x) #x
8989
#define STRINGIZE(x) STRINGIZEx(x)
90-
DLLEXPORT const char *utf8proc_version(void) {
90+
UTF8PROC_DLLEXPORT const char *utf8proc_version(void) {
9191
return STRINGIZE(UTF8PROC_VERSION_MAJOR) "." STRINGIZE(UTF8PROC_VERSION_MINOR) "." STRINGIZE(UTF8PROC_VERSION_PATCH) "";
9292
}
9393

94-
DLLEXPORT const char *utf8proc_errmsg(ssize_t errcode) {
94+
UTF8PROC_DLLEXPORT const char *utf8proc_errmsg(ssize_t errcode) {
9595
switch (errcode) {
9696
case UTF8PROC_ERROR_NOMEM:
9797
return "Memory for processing UTF-8 data could not be allocated.";
@@ -108,7 +108,7 @@ DLLEXPORT const char *utf8proc_errmsg(ssize_t errcode) {
108108
}
109109
}
110110

111-
DLLEXPORT ssize_t utf8proc_iterate(
111+
UTF8PROC_DLLEXPORT ssize_t utf8proc_iterate(
112112
const uint8_t *str, ssize_t strlen, int32_t *dst
113113
) {
114114
int length;
@@ -148,14 +148,14 @@ DLLEXPORT ssize_t utf8proc_iterate(
148148
return length;
149149
}
150150

151-
DLLEXPORT bool utf8proc_codepoint_valid(int32_t uc) {
151+
UTF8PROC_DLLEXPORT bool utf8proc_codepoint_valid(int32_t uc) {
152152
if (uc < 0 || uc >= 0x110000 ||
153153
((uc & 0xFFFF) >= 0xFFFE) || (uc >= 0xD800 && uc < 0xE000) ||
154154
(uc >= 0xFDD0 && uc < 0xFDF0)) return false;
155155
else return true;
156156
}
157157

158-
DLLEXPORT ssize_t utf8proc_encode_char(int32_t uc, uint8_t *dst) {
158+
UTF8PROC_DLLEXPORT ssize_t utf8proc_encode_char(int32_t uc, uint8_t *dst) {
159159
if (uc < 0x00) {
160160
return 0;
161161
} else if (uc < 0x80) {
@@ -195,7 +195,7 @@ static const utf8proc_property_t *get_property(int32_t uc) {
195195
);
196196
}
197197

198-
DLLEXPORT const utf8proc_property_t *utf8proc_get_property(int32_t uc) {
198+
UTF8PROC_DLLEXPORT const utf8proc_property_t *utf8proc_get_property(int32_t uc) {
199199
return uc < 0 || uc >= 0x110000 ? utf8proc_properties : get_property(uc);
200200
}
201201

@@ -226,22 +226,22 @@ static bool grapheme_break(int lbc, int tbc) {
226226
}
227227

228228
/* return whether there is a grapheme break between codepoints c1 and c2 */
229-
DLLEXPORT bool utf8proc_grapheme_break(int32_t c1, int32_t c2) {
229+
UTF8PROC_DLLEXPORT bool utf8proc_grapheme_break(int32_t c1, int32_t c2) {
230230
return grapheme_break(utf8proc_get_property(c1)->boundclass,
231231
utf8proc_get_property(c2)->boundclass);
232232
}
233233

234234
/* return a character width analogous to wcwidth (except portable and
235235
hopefully less buggy than most system wcwidth functions). */
236-
DLLEXPORT int utf8proc_charwidth(int32_t c) {
236+
UTF8PROC_DLLEXPORT int utf8proc_charwidth(int32_t c) {
237237
return utf8proc_get_property(c)->charwidth;
238238
}
239239

240-
DLLEXPORT utf8proc_category_t utf8proc_category(int32_t c) {
240+
UTF8PROC_DLLEXPORT utf8proc_category_t utf8proc_category(int32_t c) {
241241
return utf8proc_get_property(c)->category;
242242
}
243243

244-
DLLEXPORT const char *utf8proc_category_string(int32_t c) {
244+
UTF8PROC_DLLEXPORT const char *utf8proc_category_string(int32_t c) {
245245
static const char s[][3] = {"Cn","Lu","Ll","Lt","Lm","Lo","Mn","Mc","Me","Nd","Nl","No","Pc","Pd","Ps","Pe","Pi","Pf","Po","Sm","Sc","Sk","So","Zs","Zl","Zp","Cc","Cf","Cs","Co"};
246246
return s[utf8proc_category(c)];
247247
}
@@ -250,7 +250,7 @@ DLLEXPORT const char *utf8proc_category_string(int32_t c) {
250250
return utf8proc_decompose_char((replacement_uc), dst, bufsize, \
251251
options & ~UTF8PROC_LUMP, last_boundclass)
252252

253-
DLLEXPORT ssize_t utf8proc_decompose_char(int32_t uc, int32_t *dst, ssize_t bufsize, utf8proc_option_t options, int *last_boundclass) {
253+
UTF8PROC_DLLEXPORT ssize_t utf8proc_decompose_char(int32_t uc, int32_t *dst, ssize_t bufsize, utf8proc_option_t options, int *last_boundclass) {
254254
const utf8proc_property_t *property;
255255
utf8proc_propval_t category;
256256
int32_t hangul_sindex;
@@ -354,7 +354,7 @@ DLLEXPORT ssize_t utf8proc_decompose_char(int32_t uc, int32_t *dst, ssize_t bufs
354354
return 1;
355355
}
356356

357-
DLLEXPORT ssize_t utf8proc_decompose(
357+
UTF8PROC_DLLEXPORT ssize_t utf8proc_decompose(
358358
const uint8_t *str, ssize_t strlen,
359359
int32_t *buffer, ssize_t bufsize, utf8proc_option_t options
360360
) {
@@ -416,7 +416,7 @@ DLLEXPORT ssize_t utf8proc_decompose(
416416
return wpos;
417417
}
418418

419-
DLLEXPORT ssize_t utf8proc_reencode(int32_t *buffer, ssize_t length, utf8proc_option_t options) {
419+
UTF8PROC_DLLEXPORT ssize_t utf8proc_reencode(int32_t *buffer, ssize_t length, utf8proc_option_t options) {
420420
/* UTF8PROC_NULLTERM option will be ignored, 'length' is never ignored
421421
ASSERT: 'buffer' has one spare byte of free space at the end! */
422422
if (options & (UTF8PROC_NLF2LS | UTF8PROC_NLF2PS | UTF8PROC_STRIPCC)) {
@@ -531,7 +531,7 @@ DLLEXPORT ssize_t utf8proc_reencode(int32_t *buffer, ssize_t length, utf8proc_op
531531
}
532532
}
533533

534-
DLLEXPORT ssize_t utf8proc_map(
534+
UTF8PROC_DLLEXPORT ssize_t utf8proc_map(
535535
const uint8_t *str, ssize_t strlen, uint8_t **dstptr, utf8proc_option_t options
536536
) {
537537
int32_t *buffer;
@@ -560,28 +560,28 @@ DLLEXPORT ssize_t utf8proc_map(
560560
return result;
561561
}
562562

563-
DLLEXPORT uint8_t *utf8proc_NFD(const uint8_t *str) {
563+
UTF8PROC_DLLEXPORT uint8_t *utf8proc_NFD(const uint8_t *str) {
564564
uint8_t *retval;
565565
utf8proc_map(str, 0, &retval, UTF8PROC_NULLTERM | UTF8PROC_STABLE |
566566
UTF8PROC_DECOMPOSE);
567567
return retval;
568568
}
569569

570-
DLLEXPORT uint8_t *utf8proc_NFC(const uint8_t *str) {
570+
UTF8PROC_DLLEXPORT uint8_t *utf8proc_NFC(const uint8_t *str) {
571571
uint8_t *retval;
572572
utf8proc_map(str, 0, &retval, UTF8PROC_NULLTERM | UTF8PROC_STABLE |
573573
UTF8PROC_COMPOSE);
574574
return retval;
575575
}
576576

577-
DLLEXPORT uint8_t *utf8proc_NFKD(const uint8_t *str) {
577+
UTF8PROC_DLLEXPORT uint8_t *utf8proc_NFKD(const uint8_t *str) {
578578
uint8_t *retval;
579579
utf8proc_map(str, 0, &retval, UTF8PROC_NULLTERM | UTF8PROC_STABLE |
580580
UTF8PROC_DECOMPOSE | UTF8PROC_COMPAT);
581581
return retval;
582582
}
583583

584-
DLLEXPORT uint8_t *utf8proc_NFKC(const uint8_t *str) {
584+
UTF8PROC_DLLEXPORT uint8_t *utf8proc_NFKC(const uint8_t *str) {
585585
uint8_t *retval;
586586
utf8proc_map(str, 0, &retval, UTF8PROC_NULLTERM | UTF8PROC_STABLE |
587587
UTF8PROC_COMPOSE | UTF8PROC_COMPAT);

utf8proc.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ enum {false, true};
9999

100100
#ifdef _WIN32
101101
# ifdef UTF8PROC_EXPORTS
102-
# define DLLEXPORT __declspec(dllexport)
102+
# define UTF8PROC_DLLEXPORT __declspec(dllexport)
103103
# else
104-
# define DLLEXPORT __declspec(dllimport)
104+
# define UTF8PROC_DLLEXPORT __declspec(dllimport)
105105
# endif
106106
#elif __GNUC__ >= 4
107-
# define DLLEXPORT __attribute__ ((visibility("default")))
107+
# define UTF8PROC_DLLEXPORT __attribute__ ((visibility("default")))
108108
#else
109-
# define DLLEXPORT
109+
# define UTF8PROC_DLLEXPORT
110110
#endif
111111

112112
#ifdef __cplusplus
@@ -351,20 +351,20 @@ typedef enum {
351351
* Array containing the byte lengths of a UTF-8 encoded codepoint based
352352
* on the first byte.
353353
*/
354-
DLLEXPORT extern const int8_t utf8proc_utf8class[256];
354+
UTF8PROC_DLLEXPORT extern const int8_t utf8proc_utf8class[256];
355355

356356
/**
357357
* Returns the utf8proc API version as a string MAJOR.MINOR.PATCH
358358
* (http://semver.org format), possibly with a "-dev" suffix for
359359
* development versions.
360360
*/
361-
DLLEXPORT const char *utf8proc_version(void);
361+
UTF8PROC_DLLEXPORT const char *utf8proc_version(void);
362362

363363
/**
364364
* Returns an informative error string for the given utf8proc error code
365365
* (e.g. the error codes returned by @ref utf8proc_map).
366366
*/
367-
DLLEXPORT const char *utf8proc_errmsg(ssize_t errcode);
367+
UTF8PROC_DLLEXPORT const char *utf8proc_errmsg(ssize_t errcode);
368368

369369
/**
370370
* Reads a single codepoint from the UTF-8 sequence being pointed to by `str`.
@@ -376,15 +376,15 @@ DLLEXPORT const char *utf8proc_errmsg(ssize_t errcode);
376376
* In case of success, the number of bytes read is returned; otherwise, a
377377
* negative error code is returned.
378378
*/
379-
DLLEXPORT ssize_t utf8proc_iterate(const uint8_t *str, ssize_t strlen, int32_t *codepoint_ref);
379+
UTF8PROC_DLLEXPORT ssize_t utf8proc_iterate(const uint8_t *str, ssize_t strlen, int32_t *codepoint_ref);
380380

381381
/**
382382
* Check if a codepoint is valid (regardless of whether it has been
383383
* assigned a value by the current Unicode standard).
384384
*
385385
* @return 1 if the given `codepoint` is valid and otherwise return 0.
386386
*/
387-
DLLEXPORT bool utf8proc_codepoint_valid(int32_t codepoint);
387+
UTF8PROC_DLLEXPORT bool utf8proc_codepoint_valid(int32_t codepoint);
388388

389389
/**
390390
* Encodes the codepoint as an UTF-8 string in the byte array pointed
@@ -395,7 +395,7 @@ DLLEXPORT bool utf8proc_codepoint_valid(int32_t codepoint);
395395
*
396396
* This function does not check whether `codepoint` is valid Unicode.
397397
*/
398-
DLLEXPORT ssize_t utf8proc_encode_char(int32_t codepoint, uint8_t *dst);
398+
UTF8PROC_DLLEXPORT ssize_t utf8proc_encode_char(int32_t codepoint, uint8_t *dst);
399399

400400
/**
401401
* Look up the properties for a given codepoint.
@@ -409,7 +409,7 @@ DLLEXPORT ssize_t utf8proc_encode_char(int32_t codepoint, uint8_t *dst);
409409
* If the codepoint is unassigned or invalid, a pointer to a special struct is
410410
* returned in which `category` is 0 (@ref UTF8PROC_CATEGORY_CN).
411411
*/
412-
DLLEXPORT const utf8proc_property_t *utf8proc_get_property(int32_t codepoint);
412+
UTF8PROC_DLLEXPORT const utf8proc_property_t *utf8proc_get_property(int32_t codepoint);
413413

414414
/** Decompose a codepoint into an array of codepoints.
415415
*
@@ -438,7 +438,7 @@ DLLEXPORT const utf8proc_property_t *utf8proc_get_property(int32_t codepoint);
438438
* required buffer size is returned, while the buffer will be overwritten with
439439
* undefined data.
440440
*/
441-
DLLEXPORT ssize_t utf8proc_decompose_char(
441+
UTF8PROC_DLLEXPORT ssize_t utf8proc_decompose_char(
442442
int32_t codepoint, int32_t *dst, ssize_t bufsize,
443443
utf8proc_option_t options, int *last_boundclass
444444
);
@@ -459,7 +459,7 @@ DLLEXPORT ssize_t utf8proc_decompose_char(
459459
* required buffer size is returned, while the buffer will be overwritten with
460460
* undefined data.
461461
*/
462-
DLLEXPORT ssize_t utf8proc_decompose(
462+
UTF8PROC_DLLEXPORT ssize_t utf8proc_decompose(
463463
const uint8_t *str, ssize_t strlen,
464464
int32_t *buffer, ssize_t bufsize, utf8proc_option_t options
465465
);
@@ -489,13 +489,13 @@ DLLEXPORT ssize_t utf8proc_decompose(
489489
* entries of the array pointed to by `str` have to be in the
490490
* range `0x0000` to `0x10FFFF`. Otherwise, the program might crash!
491491
*/
492-
DLLEXPORT ssize_t utf8proc_reencode(int32_t *buffer, ssize_t length, utf8proc_option_t options);
492+
UTF8PROC_DLLEXPORT ssize_t utf8proc_reencode(int32_t *buffer, ssize_t length, utf8proc_option_t options);
493493

494494
/**
495495
* Given a pair of consecutive codepoints, return whether a grapheme break is
496496
* permitted between them (as defined by the extended grapheme clusters in UAX#29).
497497
*/
498-
DLLEXPORT bool utf8proc_grapheme_break(int32_t codepoint1, int32_t codepoint2);
498+
UTF8PROC_DLLEXPORT bool utf8proc_grapheme_break(int32_t codepoint1, int32_t codepoint2);
499499

500500
/**
501501
* Given a codepoint, return a character width analogous to `wcwidth(codepoint)`,
@@ -505,19 +505,19 @@ DLLEXPORT bool utf8proc_grapheme_break(int32_t codepoint1, int32_t codepoint2);
505505
* @note
506506
* If you want to check for particular types of non-printable characters,
507507
* (analogous to `isprint` or `iscntrl`), use @ref utf8proc_category. */
508-
DLLEXPORT int utf8proc_charwidth(int32_t codepoint);
508+
UTF8PROC_DLLEXPORT int utf8proc_charwidth(int32_t codepoint);
509509

510510
/**
511511
* Return the Unicode category for the codepoint (one of the
512512
* @ref utf8proc_category_t constants.)
513513
*/
514-
DLLEXPORT utf8proc_category_t utf8proc_category(int32_t codepoint);
514+
UTF8PROC_DLLEXPORT utf8proc_category_t utf8proc_category(int32_t codepoint);
515515

516516
/**
517517
* Return the two-letter (nul-terminated) Unicode category string for
518518
* the codepoint (e.g. `"Lu"` or `"Co"`).
519519
*/
520-
DLLEXPORT const char *utf8proc_category_string(int32_t codepoint);
520+
UTF8PROC_DLLEXPORT const char *utf8proc_category_string(int32_t codepoint);
521521

522522
/**
523523
* Maps the given UTF-8 string pointed to by `str` to a new UTF-8
@@ -537,7 +537,7 @@ DLLEXPORT const char *utf8proc_category_string(int32_t codepoint);
537537
* @note The memory of the new UTF-8 string will have been allocated
538538
* with `malloc`, and should therefore be deallocated with `free`.
539539
*/
540-
DLLEXPORT ssize_t utf8proc_map(
540+
UTF8PROC_DLLEXPORT ssize_t utf8proc_map(
541541
const uint8_t *str, ssize_t strlen, uint8_t **dstptr, utf8proc_option_t options
542542
);
543543

@@ -550,13 +550,13 @@ DLLEXPORT ssize_t utf8proc_map(
550550
*/
551551
/** @{ */
552552
/** NFD normalization (@ref UTF8PROC_DECOMPOSE). */
553-
DLLEXPORT uint8_t *utf8proc_NFD(const uint8_t *str);
553+
UTF8PROC_DLLEXPORT uint8_t *utf8proc_NFD(const uint8_t *str);
554554
/** NFC normalization (@ref UTF8PROC_COMPOSE). */
555-
DLLEXPORT uint8_t *utf8proc_NFC(const uint8_t *str);
555+
UTF8PROC_DLLEXPORT uint8_t *utf8proc_NFC(const uint8_t *str);
556556
/** NFD normalization (@ref UTF8PROC_DECOMPOSE and @ref UTF8PROC_COMPAT). */
557-
DLLEXPORT uint8_t *utf8proc_NFKD(const uint8_t *str);
557+
UTF8PROC_DLLEXPORT uint8_t *utf8proc_NFKD(const uint8_t *str);
558558
/** NFD normalization (@ref UTF8PROC_COMPOSE and @ref UTF8PROC_COMPAT). */
559-
DLLEXPORT uint8_t *utf8proc_NFKC(const uint8_t *str);
559+
UTF8PROC_DLLEXPORT uint8_t *utf8proc_NFKC(const uint8_t *str);
560560
/** @} */
561561

562562
#ifdef __cplusplus

0 commit comments

Comments
 (0)