##// END OF EJS Templates
index: create function for deleting node from nodetree...
Martin von Zweigbergk -
r38881:f9fc59ea default
parent child Browse files
Show More
@@ -1093,6 +1093,12 b' static int nt_insert(indexObject *self, '
1093 return -1;
1093 return -1;
1094 }
1094 }
1095
1095
1096 static int nt_delete_node(indexObject *self, const char *node)
1097 {
1098 /* rev==-1 happens to get encoded as 0, which is interpreted as not set */
1099 return nt_insert(self, node, -1);
1100 }
1101
1096 static int nt_init(indexObject *self)
1102 static int nt_init(indexObject *self)
1097 {
1103 {
1098 if (self->nt == NULL) {
1104 if (self->nt == NULL) {
@@ -1792,7 +1798,7 b' static void nt_invalidate_added(indexObj'
1792 PyObject *tuple = PyList_GET_ITEM(self->added, i);
1798 PyObject *tuple = PyList_GET_ITEM(self->added, i);
1793 PyObject *node = PyTuple_GET_ITEM(tuple, 7);
1799 PyObject *node = PyTuple_GET_ITEM(tuple, 7);
1794
1800
1795 nt_insert(self, PyBytes_AS_STRING(node), -1);
1801 nt_delete_node(self, PyBytes_AS_STRING(node));
1796 }
1802 }
1797
1803
1798 if (start == 0)
1804 if (start == 0)
@@ -1851,7 +1857,7 b' static int index_slice_del(indexObject *'
1851 if (node == NULL)
1857 if (node == NULL)
1852 return -1;
1858 return -1;
1853
1859
1854 nt_insert(self, node, -1);
1860 nt_delete_node(self, node);
1855 }
1861 }
1856 if (self->added)
1862 if (self->added)
1857 nt_invalidate_added(self, 0);
1863 nt_invalidate_added(self, 0);
@@ -1903,7 +1909,7 b' static int index_assign_subscript(indexO'
1903 return -1;
1909 return -1;
1904
1910
1905 if (value == NULL)
1911 if (value == NULL)
1906 return self->nt ? nt_insert(self, node, -1) : 0;
1912 return self->nt ? nt_delete_node(self, node) : 0;
1907 rev = PyInt_AsLong(value);
1913 rev = PyInt_AsLong(value);
1908 if (rev > INT_MAX || rev < 0) {
1914 if (rev > INT_MAX || rev < 0) {
1909 if (!PyErr_Occurred())
1915 if (!PyErr_Occurred())
General Comments 0
You need to be logged in to leave comments. Login now