Skip to content

Commit 955e66d

Browse files
committed
rename npy_load_string to npy_string_load
1 parent a525a16 commit 955e66d

File tree

5 files changed

+32
-32
lines changed

5 files changed

+32
-32
lines changed

stringdtype/stringdtype/src/casts.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ string_to_string(PyArrayMethod_Context *context, char *const data[],
9797
}
9898
}
9999
else if (free_and_copy(idescr->allocator, odescr->allocator, s, os,
100-
"string to string cast") == -1) {
100+
"string to string cast") == -1) {
101101
return -1;
102102
}
103103
}
@@ -240,7 +240,7 @@ unicode_to_string(PyArrayMethod_Context *context, char *const data[],
240240
return -1;
241241
}
242242
npy_static_string out_ss = {0, NULL};
243-
int is_null = npy_load_string(allocator, out_pss, &out_ss);
243+
int is_null = npy_string_load(allocator, out_pss, &out_ss);
244244
if (is_null == -1) {
245245
gil_error(PyExc_MemoryError,
246246
"Failed to load string in unicode to string cast");
@@ -373,7 +373,7 @@ string_to_unicode(PyArrayMethod_Context *context, char *const data[],
373373
npy_static_string name;
374374
unsigned char *this_string = NULL;
375375
size_t n_bytes;
376-
int is_null = npy_load_string(allocator, ps, &s);
376+
int is_null = npy_string_load(allocator, ps, &s);
377377
if (is_null == -1) {
378378
gil_error(PyExc_MemoryError,
379379
"Failed to load string in unicode to string cast");
@@ -473,7 +473,7 @@ string_to_bool(PyArrayMethod_Context *context, char *const data[],
473473
while (N--) {
474474
const npy_packed_static_string *ps = (npy_packed_static_string *)in;
475475
npy_static_string s = {0, NULL};
476-
int is_null = npy_load_string(allocator, ps, &s);
476+
int is_null = npy_string_load(allocator, ps, &s);
477477
if (is_null == -1) {
478478
gil_error(PyExc_MemoryError,
479479
"Failed to load string in unicode to string cast");
@@ -577,7 +577,7 @@ string_to_pylong(char *in, int hasnull,
577577
{
578578
const npy_packed_static_string *ps = (npy_packed_static_string *)in;
579579
npy_static_string s = {0, NULL};
580-
int isnull = npy_load_string(allocator, ps, &s);
580+
int isnull = npy_string_load(allocator, ps, &s);
581581
if (isnull == -1) {
582582
PyErr_SetString(PyExc_MemoryError,
583583
"Failed to load string converting string to int");
@@ -860,7 +860,7 @@ string_to_pyfloat(char *in, int hasnull,
860860
{
861861
const npy_packed_static_string *ps = (npy_packed_static_string *)in;
862862
npy_static_string s = {0, NULL};
863-
int isnull = npy_load_string(allocator, ps, &s);
863+
int isnull = npy_string_load(allocator, ps, &s);
864864
if (isnull == -1) {
865865
PyErr_SetString(
866866
PyExc_MemoryError,
@@ -1104,7 +1104,7 @@ string_to_datetime(PyArrayMethod_Context *context, char *const data[],
11041104
while (N--) {
11051105
const npy_packed_static_string *ps = (npy_packed_static_string *)in;
11061106
npy_static_string s = {0, NULL};
1107-
int is_null = npy_load_string(allocator, ps, &s);
1107+
int is_null = npy_string_load(allocator, ps, &s);
11081108
if (is_null == -1) {
11091109
// do we hold the gil in this cast? error handling below seems to
11101110
// think we do

stringdtype/stringdtype/src/dtype.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ new_stringdtype_instance(PyObject *na_object, int coerce)
104104
snew->array_owned = 0;
105105

106106
npy_static_string default_string = {0, NULL};
107-
if (npy_load_string(allocator, &snew->packed_default_string,
107+
if (npy_string_load(allocator, &snew->packed_default_string,
108108
&default_string) == -1) {
109109
PyErr_SetString(PyExc_MemoryError,
110110
"Failed to load packed string while "
@@ -114,7 +114,7 @@ new_stringdtype_instance(PyObject *na_object, int coerce)
114114
}
115115

116116
npy_static_string na_name = {0, NULL};
117-
if (npy_load_string(allocator, &snew->packed_na_name, &na_name) == -1) {
117+
if (npy_string_load(allocator, &snew->packed_na_name, &na_name) == -1) {
118118
PyErr_SetString(PyExc_MemoryError,
119119
"Failed to load packed string while "
120120
"creating StringDType instance.");
@@ -317,7 +317,7 @@ stringdtype_getitem(StringDTypeObject *descr, char **dataptr)
317317
npy_packed_static_string *psdata = (npy_packed_static_string *)dataptr;
318318
npy_static_string sdata = {0, NULL};
319319
int hasnull = descr->na_object != NULL;
320-
int is_null = npy_load_string(descr->allocator, psdata, &sdata);
320+
int is_null = npy_string_load(descr->allocator, psdata, &sdata);
321321

322322
if (is_null < 0) {
323323
PyErr_SetString(PyExc_MemoryError,
@@ -387,10 +387,10 @@ _compare(void *a, void *b, StringDTypeObject *descr_a,
387387
npy_static_string *default_string = &descr_a->default_string;
388388
const npy_packed_static_string *ps_a = (npy_packed_static_string *)a;
389389
npy_static_string s_a = {0, NULL};
390-
int a_is_null = npy_load_string(allocator_a, ps_a, &s_a);
390+
int a_is_null = npy_string_load(allocator_a, ps_a, &s_a);
391391
const npy_packed_static_string *ps_b = (npy_packed_static_string *)b;
392392
npy_static_string s_b = {0, NULL};
393-
int b_is_null = npy_load_string(allocator_b, ps_b, &s_b);
393+
int b_is_null = npy_string_load(allocator_b, ps_b, &s_b);
394394
if (NPY_UNLIKELY(a_is_null == -1 || b_is_null == -1)) {
395395
char *msg = "Failed to load string in string comparison";
396396
if (hasnull && !(has_string_na && has_nan_na)) {

stringdtype/stringdtype/src/static_string.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ is_not_a_vstring(const npy_packed_static_string *s)
214214
}
215215

216216
int
217-
npy_load_string(npy_string_allocator *allocator,
217+
npy_string_load(npy_string_allocator *allocator,
218218
const npy_packed_static_string *packed_string,
219219
npy_static_string *unpacked_string)
220220
{

stringdtype/stringdtype/src/static_string.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ typedef struct npy_static_string {
1717
// npy_static_string API functions.
1818
extern const npy_packed_static_string *NPY_EMPTY_STRING;
1919
// Represents a sentinel value, use npy_string_isnull or the return value of
20-
// npy_load_string to check if a value is null before working with the unpacked
20+
// npy_string_load to check if a value is null before working with the unpacked
2121
// representation.
2222
extern const npy_packed_static_string *NPY_NULL_STRING;
2323

@@ -113,7 +113,7 @@ npy_string_cmp(const npy_static_string *s1, const npy_static_string *s2);
113113
// string, and returns 0 otherwise. This function can be used to
114114
// simultaneously unpack a string and determine if it is a null string.
115115
int
116-
npy_load_string(npy_string_allocator *allocator,
116+
npy_string_load(npy_string_allocator *allocator,
117117
const npy_packed_static_string *packed_string,
118118
npy_static_string *unpacked_string);
119119

stringdtype/stringdtype/src/umath.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ multiply_resolve_descriptors(
5757
"Failed to deallocate string in multiply"); \
5858
return -1; \
5959
} \
60-
int is_isnull = npy_load_string(idescr->allocator, ips, &is); \
60+
int is_isnull = npy_string_load(idescr->allocator, ips, &is); \
6161
if (is_isnull == -1) { \
6262
gil_error(PyExc_MemoryError, \
6363
"Failed to load string in multiply"); \
@@ -94,7 +94,7 @@ multiply_resolve_descriptors(
9494
} \
9595
\
9696
npy_static_string os = {0, NULL}; \
97-
int is_null = npy_load_string(odescr->allocator, ops, &os); \
97+
int is_null = npy_string_load(odescr->allocator, ops, &os); \
9898
if (is_null == -1) { \
9999
gil_error(PyExc_MemoryError, \
100100
"Failed to load string in string multiply"); \
@@ -259,10 +259,10 @@ add_strided_loop(PyArrayMethod_Context *context, char *const data[],
259259
while (N--) {
260260
const npy_packed_static_string *ps1 = (npy_packed_static_string *)in1;
261261
npy_static_string s1 = {0, NULL};
262-
int s1_isnull = npy_load_string(s1descr->allocator, ps1, &s1);
262+
int s1_isnull = npy_string_load(s1descr->allocator, ps1, &s1);
263263
const npy_packed_static_string *ps2 = (npy_packed_static_string *)in2;
264264
npy_static_string s2 = {0, NULL};
265-
int s2_isnull = npy_load_string(s2descr->allocator, ps2, &s2);
265+
int s2_isnull = npy_string_load(s2descr->allocator, ps2, &s2);
266266
if (s1_isnull == -1 || s2_isnull == -1) {
267267
gil_error(PyExc_MemoryError, "Failed to load string in add");
268268
return -1;
@@ -307,7 +307,7 @@ add_strided_loop(PyArrayMethod_Context *context, char *const data[],
307307

308308
npy_static_string os = {0, NULL};
309309

310-
if (npy_load_string(odescr->allocator, ops, &os) < 0) {
310+
if (npy_string_load(odescr->allocator, ops, &os) < 0) {
311311
gil_error(PyExc_MemoryError, "Failed to load string in add");
312312
};
313313

@@ -442,10 +442,10 @@ string_equal_strided_loop(PyArrayMethod_Context *context, char *const data[],
442442
while (N--) {
443443
const npy_packed_static_string *ps1 = (npy_packed_static_string *)in1;
444444
npy_static_string s1 = {0, NULL};
445-
int s1_isnull = npy_load_string(descr1->allocator, ps1, &s1);
445+
int s1_isnull = npy_string_load(descr1->allocator, ps1, &s1);
446446
const npy_packed_static_string *ps2 = (npy_packed_static_string *)in2;
447447
npy_static_string s2 = {0, NULL};
448-
int s2_isnull = npy_load_string(descr2->allocator, ps2, &s2);
448+
int s2_isnull = npy_string_load(descr2->allocator, ps2, &s2);
449449
if (NPY_UNLIKELY(s1_isnull < 0 || s2_isnull < 0)) {
450450
gil_error(PyExc_MemoryError, "Failed to load string in equal");
451451
return -1;
@@ -513,10 +513,10 @@ string_not_equal_strided_loop(PyArrayMethod_Context *context,
513513
while (N--) {
514514
const npy_packed_static_string *ps1 = (npy_packed_static_string *)in1;
515515
npy_static_string s1 = {0, NULL};
516-
int s1_isnull = npy_load_string(descr1->allocator, ps1, &s1);
516+
int s1_isnull = npy_string_load(descr1->allocator, ps1, &s1);
517517
const npy_packed_static_string *ps2 = (npy_packed_static_string *)in2;
518518
npy_static_string s2 = {0, NULL};
519-
int s2_isnull = npy_load_string(descr2->allocator, ps2, &s2);
519+
int s2_isnull = npy_string_load(descr2->allocator, ps2, &s2);
520520
if (NPY_UNLIKELY(s1_isnull < 0 || s2_isnull < 0)) {
521521
gil_error(PyExc_MemoryError, "Failed to load string in not equal");
522522
return -1;
@@ -584,10 +584,10 @@ string_greater_strided_loop(PyArrayMethod_Context *context, char *const data[],
584584
while (N--) {
585585
const npy_packed_static_string *ps1 = (npy_packed_static_string *)in1;
586586
npy_static_string s1 = {0, NULL};
587-
int s1_isnull = npy_load_string(descr1->allocator, ps1, &s1);
587+
int s1_isnull = npy_string_load(descr1->allocator, ps1, &s1);
588588
const npy_packed_static_string *ps2 = (npy_packed_static_string *)in2;
589589
npy_static_string s2 = {0, NULL};
590-
int s2_isnull = npy_load_string(descr2->allocator, ps2, &s2);
590+
int s2_isnull = npy_string_load(descr2->allocator, ps2, &s2);
591591
if (NPY_UNLIKELY(s1_isnull < 0 || s2_isnull < 0)) {
592592
gil_error(PyExc_MemoryError, "Failed to load string in greater");
593593
return -1;
@@ -653,10 +653,10 @@ string_greater_equal_strided_loop(PyArrayMethod_Context *context,
653653
while (N--) {
654654
const npy_packed_static_string *ps1 = (npy_packed_static_string *)in1;
655655
npy_static_string s1 = {0, NULL};
656-
int s1_isnull = npy_load_string(descr1->allocator, ps1, &s1);
656+
int s1_isnull = npy_string_load(descr1->allocator, ps1, &s1);
657657
const npy_packed_static_string *ps2 = (npy_packed_static_string *)in2;
658658
npy_static_string s2 = {0, NULL};
659-
int s2_isnull = npy_load_string(descr2->allocator, ps2, &s2);
659+
int s2_isnull = npy_string_load(descr2->allocator, ps2, &s2);
660660
if (NPY_UNLIKELY(s1_isnull < 0 || s2_isnull < 0)) {
661661
gil_error(PyExc_MemoryError,
662662
"Failed to load string in greater equal");
@@ -721,10 +721,10 @@ string_less_strided_loop(PyArrayMethod_Context *context, char *const data[],
721721
while (N--) {
722722
const npy_packed_static_string *ps1 = (npy_packed_static_string *)in1;
723723
npy_static_string s1 = {0, NULL};
724-
int s1_isnull = npy_load_string(descr1->allocator, ps1, &s1);
724+
int s1_isnull = npy_string_load(descr1->allocator, ps1, &s1);
725725
const npy_packed_static_string *ps2 = (npy_packed_static_string *)in2;
726726
npy_static_string s2 = {0, NULL};
727-
int s2_isnull = npy_load_string(descr2->allocator, ps2, &s2);
727+
int s2_isnull = npy_string_load(descr2->allocator, ps2, &s2);
728728
if (NPY_UNLIKELY(s1_isnull < 0 || s2_isnull < 0)) {
729729
gil_error(PyExc_MemoryError, "Failed to load string in less");
730730
return -1;
@@ -789,10 +789,10 @@ string_less_equal_strided_loop(PyArrayMethod_Context *context,
789789
while (N--) {
790790
const npy_packed_static_string *ps1 = (npy_packed_static_string *)in1;
791791
npy_static_string s1 = {0, NULL};
792-
int s1_isnull = npy_load_string(descr1->allocator, ps1, &s1);
792+
int s1_isnull = npy_string_load(descr1->allocator, ps1, &s1);
793793
const npy_packed_static_string *ps2 = (npy_packed_static_string *)in2;
794794
npy_static_string s2 = {0, NULL};
795-
int s2_isnull = npy_load_string(descr2->allocator, ps2, &s2);
795+
int s2_isnull = npy_string_load(descr2->allocator, ps2, &s2);
796796
if (NPY_UNLIKELY(s1_isnull < 0 || s2_isnull < 0)) {
797797
gil_error(PyExc_MemoryError,
798798
"Failed to load string in less equal");

0 commit comments

Comments
 (0)