User Tools

Site Tools


programming:python:pyradix_search_all_patch

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
programming:python:pyradix_search_all_patch [2008/07/05 21:32] crustymonkeyprogramming:python:pyradix_search_all_patch [2008/07/05 22:10] (current) crustymonkey
Line 61: Line 61:
 Here is the code for the patch, followed by a link to the file. Here is the code for the patch, followed by a link to the file.
 <code> <code>
---- radix_python.c  2008-07-05 16:25:24.000000000 -0500 +--- radix_python.c  2008-07-05 17:08:51.000000000 -0500 
-+++ radix_python.c.new  2008-07-05 16:15:39.000000000 -0500++++ radix_python.c.new  2008-07-05 17:08:11.000000000 -0500
 @@ -453,6 +453,52 @@ @@ -453,6 +453,52 @@
     return (PyObject *)node_obj;     return (PyObject *)node_obj;
Line 89: Line 89:
 +   long prefixlen = -1; +   long prefixlen = -1;
 +   int packlen = -1; +   int packlen = -1;
-+   node_list = PyList_New(0);++   if ((node_list = PyList_New(0)) == NULL) 
 ++       return NULL;
 + +
-+   if (!PyArg_ParseTupleAndKeywords(args, kw_args, "|sls#:search_best", keywords,++   if (!PyArg_ParseTupleAndKeywords(args, kw_args, "|sls#:search_all_containing", keywords,
 +       &addr, &prefixlen, &packed, &packlen)) +       &addr, &prefixlen, &packed, &packlen))
 +       return NULL; +       return NULL;
Line 103: Line 104:
 +   } +   }
 +   Deref_Prefix(prefix); +   Deref_Prefix(prefix);
-+   node_obj = node->data; ++   PyList_Append(node_list , (PyObject *)node->data);
-+   PyList_Append(node_list , (PyObject *)node_obj);+
 +   while ((parent = node->parent) != NULL) { +   while ((parent = node->parent) != NULL) {
-      node_obj = parent->data; +       if (parent->data != NULL) 
-      PyList_Append(node_list , (PyObject *)node_obj);+           PyList_Append(node_list , (PyObject *)parent->data);
 +       node = parent; +       node = parent;
 +   } +   }
programming/python/pyradix_search_all_patch.txt · Last modified: 2008/07/05 22:10 by crustymonkey