Skip to content

Commit 854e8d8

Browse files
Update bytes_ops.c
1 parent 85e549b commit 854e8d8

File tree

1 file changed

+0
-49
lines changed

1 file changed

+0
-49
lines changed

mypyc/lib-rt/bytes_ops.c

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#include <Python.h>
66
#include "CPy.h"
7-
#include <string.h>
87

98
// Returns -1 on error, 0 on inequality, 1 on equality.
109
//
@@ -163,51 +162,3 @@ CPyTagged CPyBytes_Ord(PyObject *obj) {
163162
PyErr_SetString(PyExc_TypeError, "ord() expects a character");
164163
return CPY_INT_TAG;
165164
}
166-
167-
PyObject *CPyBytes_Rjust(PyObject *self, Py_ssize_t width, PyObject *fillbyte) {
168-
if (!PyBytes_Check(self)) {
169-
PyErr_SetString(PyExc_TypeError, "self must be bytes");
170-
return NULL;
171-
}
172-
if (!PyBytes_Check(fillbyte) || PyBytes_Size(fillbyte) != 1) {
173-
PyErr_SetString(PyExc_TypeError, "fillbyte must be a single byte");
174-
return NULL;
175-
}
176-
Py_ssize_t len = PyBytes_Size(self);
177-
if (width <= len) {
178-
return PyBytes_FromStringAndSize(PyBytes_AsString(self), len);
179-
}
180-
char fill = PyBytes_AsString(fillbyte)[0];
181-
Py_ssize_t pad = width - len;
182-
PyObject *result = PyBytes_FromStringAndSize(NULL, width);
183-
if (!result) return NULL;
184-
char *res_buf = PyBytes_AsString(result);
185-
memset(res_buf, fill, pad);
186-
memcpy(res_buf + pad, PyBytes_AsString(self), len);
187-
return result;
188-
}
189-
190-
PyObject *CPyBytes_Ljust(PyObject *self, Py_ssize_t width, PyObject *fillbyte) {
191-
if (!PyBytes_Check(self)) {
192-
PyErr_SetString(PyExc_TypeError, "self must be bytes");
193-
return NULL;
194-
}
195-
if (!PyBytes_Check(fillbyte) || PyBytes_Size(fillbyte) != 1) {
196-
PyErr_SetString(PyExc_TypeError, "fillbyte must be a single byte");
197-
return NULL;
198-
}
199-
Py_ssize_t len = PyBytes_Size(self);
200-
if (width <= len) {
201-
return PyBytes_FromStringAndSize(PyBytes_AsString(self), len);
202-
}
203-
char fill = PyBytes_AsString(fillbyte)[0];
204-
Py_ssize_t pad = width - len;
205-
PyObject *result = PyBytes_FromStringAndSize(NULL, width);
206-
if (!result) return NULL;
207-
char *res_buf = PyBytes_AsString(result);
208-
memcpy(res_buf, PyBytes_AsString(self), len);
209-
memset(res_buf + len, fill, pad);
210-
return result;
211-
}
212-
213-
// ... existing code ...

0 commit comments

Comments
 (0)