Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b95896b

Browse files
author
Fredrik Lundh
committed
renamed internal functions to avoid name clashes under OpenVMS
(fixes bug #132815)
1 parent c0c7ee3 commit b95896b

1 file changed

Lines changed: 18 additions & 17 deletions

File tree

Modules/unicodedata.c

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ typedef struct {
2929
#include "unicodedata_db.h"
3030

3131
static const _PyUnicode_DatabaseRecord*
32-
getrecord(PyUnicodeObject* v)
32+
_getrecord(PyUnicodeObject* v)
3333
{
3434
int code;
3535
int index;
@@ -147,7 +147,7 @@ unicodedata_category(PyObject *self, PyObject *args)
147147
"need a single Unicode character as parameter");
148148
return NULL;
149149
}
150-
index = (int) getrecord(v)->category;
150+
index = (int) _getrecord(v)->category;
151151
return PyString_FromString(_PyUnicode_CategoryNames[index]);
152152
}
153153

@@ -165,7 +165,7 @@ unicodedata_bidirectional(PyObject *self, PyObject *args)
165165
"need a single Unicode character as parameter");
166166
return NULL;
167167
}
168-
index = (int) getrecord(v)->bidirectional;
168+
index = (int) _getrecord(v)->bidirectional;
169169
return PyString_FromString(_PyUnicode_BidirectionalNames[index]);
170170
}
171171

@@ -182,7 +182,7 @@ unicodedata_combining(PyObject *self, PyObject *args)
182182
"need a single Unicode character as parameter");
183183
return NULL;
184184
}
185-
return PyInt_FromLong((int) getrecord(v)->combining);
185+
return PyInt_FromLong((int) _getrecord(v)->combining);
186186
}
187187

188188
static PyObject *
@@ -198,7 +198,7 @@ unicodedata_mirrored(PyObject *self, PyObject *args)
198198
"need a single Unicode character as parameter");
199199
return NULL;
200200
}
201-
return PyInt_FromLong((int) getrecord(v)->mirrored);
201+
return PyInt_FromLong((int) _getrecord(v)->mirrored);
202202
}
203203

204204
static PyObject *
@@ -260,7 +260,7 @@ unicodedata_decomposition(PyObject *self, PyObject *args)
260260
/* database code (cut and pasted from the unidb package) */
261261

262262
static unsigned long
263-
gethash(const char *s, int len, int scale)
263+
_gethash(const char *s, int len, int scale)
264264
{
265265
int i;
266266
unsigned long h = 0;
@@ -275,7 +275,7 @@ gethash(const char *s, int len, int scale)
275275
}
276276

277277
static int
278-
getname(Py_UCS4 code, char* buffer, int buflen)
278+
_getname(Py_UCS4 code, char* buffer, int buflen)
279279
{
280280
int offset;
281281
int i;
@@ -327,12 +327,12 @@ getname(Py_UCS4 code, char* buffer, int buflen)
327327
}
328328

329329
static int
330-
cmpname(int code, const char* name, int namelen)
330+
_cmpname(int code, const char* name, int namelen)
331331
{
332332
/* check if code corresponds to the given name */
333333
int i;
334334
char buffer[NAME_MAXLEN];
335-
if (!getname(code, buffer, sizeof(buffer)))
335+
if (!_getname(code, buffer, sizeof(buffer)))
336336
return 0;
337337
for (i = 0; i < namelen; i++) {
338338
if (toupper(name[i]) != buffer[i])
@@ -342,7 +342,7 @@ cmpname(int code, const char* name, int namelen)
342342
}
343343

344344
static int
345-
getcode(const char* name, int namelen, Py_UCS4* code)
345+
_getcode(const char* name, int namelen, Py_UCS4* code)
346346
{
347347
unsigned int h, v;
348348
unsigned int mask = code_size-1;
@@ -352,12 +352,12 @@ getcode(const char* name, int namelen, Py_UCS4* code)
352352
only minor changes. see the makeunicodedata script for more
353353
details */
354354

355-
h = (unsigned int) gethash(name, namelen, code_magic);
355+
h = (unsigned int) _gethash(name, namelen, code_magic);
356356
i = (~h) & mask;
357357
v = code_hash[i];
358358
if (!v)
359359
return 0;
360-
if (cmpname(v, name, namelen)) {
360+
if (_cmpname(v, name, namelen)) {
361361
*code = v;
362362
return 1;
363363
}
@@ -369,7 +369,7 @@ getcode(const char* name, int namelen, Py_UCS4* code)
369369
v = code_hash[i];
370370
if (!v)
371371
return 0;
372-
if (cmpname(v, name, namelen)) {
372+
if (_cmpname(v, name, namelen)) {
373373
*code = v;
374374
return 1;
375375
}
@@ -382,8 +382,8 @@ getcode(const char* name, int namelen, Py_UCS4* code)
382382
static const _PyUnicode_Name_CAPI hashAPI =
383383
{
384384
sizeof(_PyUnicode_Name_CAPI),
385-
getname,
386-
getcode
385+
_getname,
386+
_getcode
387387
};
388388

389389
/* -------------------------------------------------------------------- */
@@ -405,7 +405,8 @@ unicodedata_name(PyObject* self, PyObject* args)
405405
return NULL;
406406
}
407407

408-
if (!getname((Py_UCS4) *PyUnicode_AS_UNICODE(v), name, sizeof(name))) {
408+
if (!_getname((Py_UCS4) *PyUnicode_AS_UNICODE(v),
409+
name, sizeof(name))) {
409410
if (defobj == NULL) {
410411
PyErr_SetString(PyExc_ValueError, "no such name");
411412
return NULL;
@@ -430,7 +431,7 @@ unicodedata_lookup(PyObject* self, PyObject* args)
430431
if (!PyArg_ParseTuple(args, "s#:lookup", &name, &namelen))
431432
return NULL;
432433

433-
if (!getcode(name, namelen, &code)) {
434+
if (!_getcode(name, namelen, &code)) {
434435
PyErr_SetString(PyExc_KeyError, "undefined character name");
435436
return NULL;
436437
}

0 commit comments

Comments
 (0)