Skip to content

Commit 739dd88

Browse files
committed
Inline pointer usage in memcpy calls
1 parent 5b550ae commit 739dd88

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

numcodecs/vlen.pyx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ class VLenUTF8(Codec):
8080
ndarray[object, ndim=1] input_values
8181
object[:] encoded_values
8282
int[:] encoded_lengths
83-
const char* encv
8483
bytes b
8584
bytearray out
8685
char* data
@@ -124,8 +123,7 @@ class VLenUTF8(Codec):
124123
store_le32(<uint8_t*>data, l)
125124
data += HEADER_LENGTH
126125
b = encoded_values[i]
127-
encv = b
128-
memcpy(data, encv, l)
126+
memcpy(data, <const char*>b, l)
129127
data += l
130128

131129
return out
@@ -214,7 +212,6 @@ class VLenBytes(Codec):
214212
object[:] values
215213
object[:] normed_values
216214
int[:] lengths
217-
const char* encv
218215
object o
219216
bytes b
220217
bytearray out
@@ -256,8 +253,7 @@ class VLenBytes(Codec):
256253
store_le32(<uint8_t*>data, l)
257254
data += HEADER_LENGTH
258255
b = normed_values[i]
259-
encv = b
260-
memcpy(data, encv, l)
256+
memcpy(data, <const char*>b, l)
261257
data += l
262258

263259
return out
@@ -359,7 +355,6 @@ class VLenArray(Codec):
359355
object[:] values
360356
object[:] normed_values
361357
int[:] lengths
362-
const char* encv
363358
bytes b
364359
bytearray out
365360
char* data
@@ -411,9 +406,8 @@ class VLenArray(Codec):
411406

412407
value_mv = normed_values[i]
413408
value_pb = PyMemoryView_GET_BUFFER(value_mv)
414-
encv = <const char*>value_pb.buf
415409

416-
memcpy(data, encv, l)
410+
memcpy(data, value_pb.buf, l)
417411
data += l
418412

419413
return out

0 commit comments

Comments
 (0)