From 4846ba81c69ebc815b35a89ed54fef7b5ffb1417 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Tue, 30 Aug 2016 10:47:49 -0700 Subject: Issue #27895: Spelling fixes (Contributed by Ville Skytt?). --- Modules/_tracemalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Modules/_tracemalloc.c') diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index e3329c722f..48f5b47025 100644 --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -716,7 +716,7 @@ tracemalloc_realloc(void *ctx, void *ptr, size_t new_size) if (ADD_TRACE(ptr2, new_size) < 0) { /* Memory allocation failed. The error cannot be reported to - the caller, because realloc() may already have shrinked the + the caller, because realloc() may already have shrunk the memory block and so removed bytes. This case is very unlikely: a hash entry has just been -- cgit v1.2.1 From 82b75eb31160ec9c025e450ac9fa3300d560a245 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Tue, 6 Sep 2016 13:47:26 -0700 Subject: replace Py_(u)intptr_t with the c99 standard types --- Modules/_tracemalloc.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'Modules/_tracemalloc.c') diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index 48f5b47025..1a53cfec25 100644 --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -67,7 +67,7 @@ typedef struct __attribute__((packed)) #endif { - Py_uintptr_t ptr; + uintptr_t ptr; _PyTraceMalloc_domain_t domain; } pointer_t; @@ -523,7 +523,7 @@ static int tracemalloc_use_domain_cb(_Py_hashtable_t *old_traces, _Py_hashtable_entry_t *entry, void *user_data) { - Py_uintptr_t ptr; + uintptr_t ptr; pointer_t key; _Py_hashtable_t *new_traces = (_Py_hashtable_t *)user_data; const void *pdata = _Py_HASHTABLE_ENTRY_PDATA(old_traces, entry); @@ -538,7 +538,7 @@ tracemalloc_use_domain_cb(_Py_hashtable_t *old_traces, } -/* Convert tracemalloc_traces from compact key (Py_uintptr_t) to pointer_t key. +/* Convert tracemalloc_traces from compact key (uintptr_t) to pointer_t key. * Return 0 on success, -1 on error. */ static int tracemalloc_use_domain(void) @@ -572,7 +572,7 @@ tracemalloc_use_domain(void) static void -tracemalloc_remove_trace(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr) +tracemalloc_remove_trace(_PyTraceMalloc_domain_t domain, uintptr_t ptr) { trace_t trace; int removed; @@ -595,11 +595,11 @@ tracemalloc_remove_trace(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr) } #define REMOVE_TRACE(ptr) \ - tracemalloc_remove_trace(DEFAULT_DOMAIN, (Py_uintptr_t)(ptr)) + tracemalloc_remove_trace(DEFAULT_DOMAIN, (uintptr_t)(ptr)) static int -tracemalloc_add_trace(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr, +tracemalloc_add_trace(_PyTraceMalloc_domain_t domain, uintptr_t ptr, size_t size) { pointer_t key = {ptr, domain}; @@ -617,7 +617,7 @@ tracemalloc_add_trace(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr, if (!tracemalloc_config.use_domain && domain != DEFAULT_DOMAIN) { /* first trace using a non-zero domain whereas traces use compact - (Py_uintptr_t) keys: switch to pointer_t keys. */ + (uintptr_t) keys: switch to pointer_t keys. */ if (tracemalloc_use_domain() < 0) { return -1; } @@ -663,7 +663,7 @@ tracemalloc_add_trace(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr, } #define ADD_TRACE(ptr, size) \ - tracemalloc_add_trace(DEFAULT_DOMAIN, (Py_uintptr_t)(ptr), size) + tracemalloc_add_trace(DEFAULT_DOMAIN, (uintptr_t)(ptr), size) static void* @@ -1023,7 +1023,7 @@ tracemalloc_init(void) hashtable_compare_pointer_t); } else { - tracemalloc_traces = hashtable_new(sizeof(Py_uintptr_t), + tracemalloc_traces = hashtable_new(sizeof(uintptr_t), sizeof(trace_t), _Py_hashtable_hash_ptr, _Py_hashtable_compare_direct); @@ -1414,7 +1414,7 @@ finally: static traceback_t* -tracemalloc_get_traceback(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr) +tracemalloc_get_traceback(_PyTraceMalloc_domain_t domain, uintptr_t ptr) { trace_t trace; int found; @@ -1461,7 +1461,7 @@ py_tracemalloc_get_object_traceback(PyObject *self, PyObject *obj) else ptr = (void *)obj; - traceback = tracemalloc_get_traceback(DEFAULT_DOMAIN, (Py_uintptr_t)ptr); + traceback = tracemalloc_get_traceback(DEFAULT_DOMAIN, (uintptr_t)ptr); if (traceback == NULL) Py_RETURN_NONE; @@ -1489,7 +1489,7 @@ _PyMem_DumpTraceback(int fd, const void *ptr) traceback_t *traceback; int i; - traceback = tracemalloc_get_traceback(DEFAULT_DOMAIN, (Py_uintptr_t)ptr); + traceback = tracemalloc_get_traceback(DEFAULT_DOMAIN, (uintptr_t)ptr); if (traceback == NULL) return; @@ -1762,7 +1762,7 @@ _PyTraceMalloc_Fini(void) } int -_PyTraceMalloc_Track(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr, +_PyTraceMalloc_Track(_PyTraceMalloc_domain_t domain, uintptr_t ptr, size_t size) { int res; @@ -1791,7 +1791,7 @@ _PyTraceMalloc_Track(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr, int -_PyTraceMalloc_Untrack(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr) +_PyTraceMalloc_Untrack(_PyTraceMalloc_domain_t domain, uintptr_t ptr) { if (!tracemalloc_config.tracing) { /* tracemalloc is not tracing: do nothing */ @@ -1807,7 +1807,7 @@ _PyTraceMalloc_Untrack(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr) PyObject* -_PyTraceMalloc_GetTraceback(_PyTraceMalloc_domain_t domain, Py_uintptr_t ptr) +_PyTraceMalloc_GetTraceback(_PyTraceMalloc_domain_t domain, uintptr_t ptr) { traceback_t *traceback; -- cgit v1.2.1 From 58a260158ae807ba57a7f83d13543907c13bc415 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Wed, 7 Sep 2016 09:26:18 -0700 Subject: replace PY_SIZE_MAX with SIZE_MAX --- Modules/_tracemalloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Modules/_tracemalloc.c') diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index 1a53cfec25..ec8bd960a7 100644 --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -655,7 +655,7 @@ tracemalloc_add_trace(_PyTraceMalloc_domain_t domain, uintptr_t ptr, } } - assert(tracemalloc_traced_memory <= PY_SIZE_MAX - size); + assert(tracemalloc_traced_memory <= SIZE_MAX - size); tracemalloc_traced_memory += size; if (tracemalloc_traced_memory > tracemalloc_peak_traced_memory) tracemalloc_peak_traced_memory = tracemalloc_traced_memory; @@ -672,7 +672,7 @@ tracemalloc_alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) PyMemAllocatorEx *alloc = (PyMemAllocatorEx *)ctx; void *ptr; - assert(elsize == 0 || nelem <= PY_SIZE_MAX / elsize); + assert(elsize == 0 || nelem <= SIZE_MAX / elsize); if (use_calloc) ptr = alloc->calloc(alloc->ctx, nelem, elsize); -- cgit v1.2.1