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
Next revision
Previous revision
Last revisionBoth sides next revision
programming:python:pyradix_search_all_patch [2008/07/05 21:26] crustymonkeyprogramming:python:pyradix_search_all_patch [2008/07/05 21:32] crustymonkey
Line 13: Line 13:
 Usage: Usage:
 <code> <code>
-Radix.search_all_containing(<network>) -> [ <node> , <node> , ...]+Radix.search_all_containing(<network>) -> [ <node> , <node> , ... ]
 </code> </code>
 <code python> <code python>
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 15:22:55.000000000 -0500 +--- radix_python.c  2008-07-05 16:25:24.000000000 -0500 
-+++ radix_python.c.new  2008-07-05 15:19:03.000000000 -0500 ++++ radix_python.c.new  2008-07-05 16:15:39.000000000 -0500 
-@@ -453,6 +453,53 @@+@@ -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 (!PyArg_ParseTupleAndKeywords(args, kw_args, "|sls#:search_best", keywords, +   if (!PyArg_ParseTupleAndKeywords(args, kw_args, "|sls#:search_best", keywords,
Line 99: Line 100:
 +       node->data == NULL) { +       node->data == NULL) {
 +       Deref_Prefix(prefix); +       Deref_Prefix(prefix);
-+       Py_INCREF(Py_None); ++       return node_list;
-+       return Py_None;+
 +   } +   }
 +   Deref_Prefix(prefix); +   Deref_Prefix(prefix);
-+   node_list = PyList_New(0); 
 +   node_obj = node->data; +   node_obj = node->data;
 +   PyList_Append(node_list , (PyObject *)node_obj); +   PyList_Append(node_list , (PyObject *)node_obj);
Line 117: Line 116:
  "Radix.nodes(prefix) -> List of RadixNode\n\  "Radix.nodes(prefix) -> List of RadixNode\n\
  \n\  \n\
-@@ -640,6 +687,7 @@+@@ -640,6 +686,7 @@
     {"delete",  (PyCFunction)Radix_delete,  METH_VARARGS|METH_KEYWORDS, Radix_delete_doc    },     {"delete",  (PyCFunction)Radix_delete,  METH_VARARGS|METH_KEYWORDS, Radix_delete_doc    },
     {"search_exact",(PyCFunction)Radix_search_exact,METH_VARARGS|METH_KEYWORDS, Radix_search_exact_doc  },     {"search_exact",(PyCFunction)Radix_search_exact,METH_VARARGS|METH_KEYWORDS, Radix_search_exact_doc  },
programming/python/pyradix_search_all_patch.txt · Last modified: 2008/07/05 22:10 by crustymonkey