Skip to content

Commit 00b04be

Browse files
committed
Remove unused code
1 parent 31aea66 commit 00b04be

File tree

2 files changed

+0
-98
lines changed

2 files changed

+0
-98
lines changed

src/utils.c

-97
Original file line numberDiff line numberDiff line change
@@ -63,29 +63,6 @@ to_unicode_safe(const char *value, const char *encoding)
6363
return py_str;
6464
}
6565

66-
/**
67-
* Return a *newly allocated* C string holding the string contained in the
68-
* 'value' argument.
69-
*/
70-
char *
71-
pgit_encode(PyObject *value, const char *encoding)
72-
{
73-
PyObject *tmp = NULL;
74-
75-
const char *borrowed = pgit_borrow_encoding(value, encoding, NULL, &tmp);
76-
if (!borrowed)
77-
return NULL;
78-
79-
char *c_str = strdup(borrowed);
80-
Py_DECREF(tmp);
81-
82-
if (!c_str) {
83-
// FIXME Set exception
84-
}
85-
86-
return c_str;
87-
}
88-
8966
char*
9067
pgit_borrow_fsdefault(PyObject *value, PyObject **tvalue)
9168
{
@@ -174,80 +151,6 @@ pgit_borrow(PyObject *value)
174151
}
175152

176153

177-
/**
178-
* Converts the (struct) git_strarray to a Python list
179-
*/
180-
/*
181-
PyObject *
182-
get_pylist_from_git_strarray(git_strarray *strarray)
183-
{
184-
size_t index;
185-
PyObject *new_list;
186-
187-
new_list = PyList_New(strarray->count);
188-
if (new_list == NULL)
189-
return NULL;
190-
191-
for (index = 0; index < strarray->count; index++)
192-
PyList_SET_ITEM(new_list, index,
193-
to_unicode(strarray->strings[index], NULL, NULL));
194-
195-
return new_list;
196-
}
197-
*/
198-
199-
/**
200-
* Converts the Python list to struct git_strarray
201-
* returns -1 if conversion failed
202-
*/
203-
/*
204-
int
205-
get_strarraygit_from_pylist(git_strarray *array, PyObject *pylist)
206-
{
207-
Py_ssize_t index, n;
208-
PyObject *item;
209-
void *ptr;
210-
char *str;
211-
212-
if (!PyList_Check(pylist)) {
213-
PyErr_SetString(PyExc_TypeError, "Value must be a list");
214-
return -1;
215-
}
216-
217-
n = PyList_Size(pylist);
218-
219-
// allocate new git_strarray
220-
ptr = calloc(n, sizeof(char *));
221-
if (!ptr) {
222-
PyErr_SetNone(PyExc_MemoryError);
223-
return -1;
224-
}
225-
226-
array->strings = ptr;
227-
array->count = n;
228-
229-
for (index = 0; index < n; index++) {
230-
item = PyList_GetItem(pylist, index);
231-
str = pgit_encode(item, NULL);
232-
if (!str)
233-
goto on_error;
234-
235-
array->strings[index] = str;
236-
}
237-
238-
return 0;
239-
240-
on_error:
241-
n = index;
242-
for (index = 0; index < n; index++) {
243-
free(array->strings[index]);
244-
}
245-
free(array->strings);
246-
247-
return -1;
248-
}
249-
*/
250-
251154
static git_otype
252155
py_type_to_git_type(PyTypeObject *py_type)
253156
{

src/utils.h

-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ to_unicode_n(const char *value, size_t len, const char *encoding,
8989

9090
const char* pgit_borrow(PyObject *value);
9191
const char* pgit_borrow_encoding(PyObject *value, const char *encoding, const char *errors, PyObject **tvalue);
92-
char* pgit_encode(PyObject *value, const char *encoding);
9392
char* pgit_borrow_fsdefault(PyObject *value, PyObject **tvalue);
9493

9594

0 commit comments

Comments
 (0)