Merge lp:~cjwatson/meliae/syntax-cleanups into lp:meliae

Proposed by Colin Watson
Status: Merged
Approved by: John A Meinel
Approved revision: 202
Merged at revision: 205
Proposed branch: lp:~cjwatson/meliae/syntax-cleanups
Merge into: lp:meliae
Prerequisite: lp:~cjwatson/meliae/tox
Diff against target: 131 lines (+20/-12)
4 files modified
meliae/_intset.pyx (+6/-3)
meliae/_loader.pyx (+8/-3)
meliae/_scanner_core.c (+4/-4)
meliae/_scanner_core.h (+2/-2)
To merge this branch: bzr merge lp:~cjwatson/meliae/syntax-cleanups
Reviewer Review Type Date Requested Status
John A Meinel Approve
Review via email: mp+378249@code.launchpad.net

Commit message

Fix some minor Cython/C warnings.

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

LGTM, assuming the precursor lands

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'meliae/_intset.pyx'
--- meliae/_intset.pyx 2010-07-28 21:13:06 +0000
+++ meliae/_intset.pyx 2020-01-29 13:16:24 +0000
@@ -85,7 +85,8 @@
85 cdef int_type *_lookup(self, int_type c_val) except NULL:85 cdef int_type *_lookup(self, int_type c_val) except NULL:
86 """Taken from the set() algorithm."""86 """Taken from the set() algorithm."""
87 cdef size_t offset, perturb87 cdef size_t offset, perturb
88 cdef int_type *entry, *freeslot88 cdef int_type *entry
89 cdef int_type *freeslot
8990
90 if self._array == NULL:91 if self._array == NULL:
91 raise RuntimeError('cannot _lookup without _array allocated.')92 raise RuntimeError('cannot _lookup without _array allocated.')
@@ -145,7 +146,8 @@
145 cdef int _grow(self) except -1:146 cdef int _grow(self) except -1:
146 cdef int i147 cdef int i
147 cdef Py_ssize_t old_mask, old_size, new_size, old_count148 cdef Py_ssize_t old_mask, old_size, new_size, old_count
148 cdef int_type *old_array, val149 cdef int_type *old_array
150 cdef int_type val
149151
150 old_mask = self._mask152 old_mask = self._mask
151 old_size = old_mask + 1153 old_size = old_mask + 1
@@ -244,7 +246,8 @@
244 cdef int_type *_lookup(self, int_type c_val) except NULL:246 cdef int_type *_lookup(self, int_type c_val) except NULL:
245 """Taken from the set() algorithm."""247 """Taken from the set() algorithm."""
246 cdef size_t offset, perturb248 cdef size_t offset, perturb
247 cdef int_type *entry, *freeslot249 cdef int_type *entry
250 cdef int_type *freeslot
248 cdef int_type internal_val251 cdef int_type internal_val
249252
250 if self._array == NULL:253 if self._array == NULL:
251254
=== modified file 'meliae/_loader.pyx'
--- meliae/_loader.pyx 2013-05-19 06:13:48 +0000
+++ meliae/_loader.pyx 2020-01-29 13:16:24 +0000
@@ -705,7 +705,9 @@
705 cdef long the_hash705 cdef long the_hash
706 cdef size_t i, n_lookup706 cdef size_t i, n_lookup
707 cdef long mask707 cdef long mask
708 cdef _MemObject **table, **slot, **free_slot708 cdef _MemObject **table
709 cdef _MemObject **slot
710 cdef _MemObject **free_slot
709 cdef PyObject *py_addr711 cdef PyObject *py_addr
710712
711 py_addr = <PyObject *>address713 py_addr = <PyObject *>address
@@ -859,7 +861,9 @@
859 """861 """
860 cdef int new_size, remaining862 cdef int new_size, remaining
861 cdef size_t n_bytes863 cdef size_t n_bytes
862 cdef _MemObject **old_table, **old_slot, **new_table864 cdef _MemObject **old_table
865 cdef _MemObject **old_slot
866 cdef _MemObject **new_table
863867
864 new_size = 1024868 new_size = 1024
865 while new_size <= min_active and new_size > 0:869 while new_size <= min_active and new_size > 0:
@@ -896,7 +900,8 @@
896 def add(self, address, type_str, size, children=(), length=0,900 def add(self, address, type_str, size, children=(), length=0,
897 value=None, name=None, parent_list=(), total_size=0):901 value=None, name=None, parent_list=(), total_size=0):
898 """Add a new MemObject to this collection."""902 """Add a new MemObject to this collection."""
899 cdef _MemObject **slot, *new_entry903 cdef _MemObject **slot
904 cdef _MemObject *new_entry
900 cdef _MemObjectProxy proxy905 cdef _MemObjectProxy proxy
901906
902 slot = self._lookup(address)907 slot = self._lookup(address)
903908
=== modified file 'meliae/_scanner_core.c'
--- meliae/_scanner_core.c 2012-11-20 10:46:37 +0000
+++ meliae/_scanner_core.c 2020-01-29 13:16:24 +0000
@@ -60,7 +60,7 @@
60#else60#else
61static void _write_to_ref_info(struct ref_info *info, const char *fmt_string, ...);61static void _write_to_ref_info(struct ref_info *info, const char *fmt_string, ...);
62#endif62#endif
63static PyObject * _get_specials();63static PyObject * _get_specials(void);
6464
65/* The address of the last thing we dumped. Stuff like dumping the string65/* The address of the last thing we dumped. Stuff like dumping the string
66 * interned dictionary will dump the same string 2x in a row. This helps66 * interned dictionary will dump the same string 2x in a row. This helps
@@ -70,7 +70,7 @@
70static PyObject *_special_case_dict = NULL;70static PyObject *_special_case_dict = NULL;
7171
72void72void
73_clear_last_dumped()73_clear_last_dumped(void)
74{74{
75 _last_dumped = NULL;75 _last_dumped = NULL;
76}76}
@@ -617,7 +617,7 @@
617}617}
618618
619static PyObject *619static PyObject *
620_get_specials()620_get_specials(void)
621{621{
622 if (_special_case_dict == NULL) {622 if (_special_case_dict == NULL) {
623 _special_case_dict = PyDict_New();623 _special_case_dict = PyDict_New();
@@ -626,7 +626,7 @@
626}626}
627627
628PyObject *628PyObject *
629_get_special_case_dict()629_get_special_case_dict(void)
630{630{
631 PyObject *ret;631 PyObject *ret;
632632
633633
=== modified file 'meliae/_scanner_core.h'
--- meliae/_scanner_core.h 2010-08-09 22:16:14 +0000
+++ meliae/_scanner_core.h 2020-01-29 13:16:24 +0000
@@ -50,7 +50,7 @@
50/**50/**
51 * Clear out what the last object we dumped was.51 * Clear out what the last object we dumped was.
52 */52 */
53extern void _clear_last_dumped();53extern void _clear_last_dumped(void);
5454
55/**55/**
56 * Return a PyList of all objects referenced via tp_traverse.56 * Return a PyList of all objects referenced via tp_traverse.
@@ -64,7 +64,7 @@
64 * figured out via trial-and-error.64 * figured out via trial-and-error.
65 * The key is tp_name strings, the value is a PyInt of the appropriate size.65 * The key is tp_name strings, the value is a PyInt of the appropriate size.
66 */66 */
67extern PyObject *_get_special_case_dict();67extern PyObject *_get_special_case_dict(void);
6868
6969
70#endif // _SCANNER_CORE_H_70#endif // _SCANNER_CORE_H_

Subscribers

People subscribed via source and target branches

to all changes: