@@ -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-
8966char *
9067pgit_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-
251154static git_otype
252155py_type_to_git_type (PyTypeObject * py_type )
253156{
0 commit comments