From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.bugs Subject: bug#9119: [PATCH] modernize function definitions in gmalloc.c Date: Mon, 18 Jul 2011 16:46:36 -0700 Message-ID: <4E24C5DC.50709@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig15ED011E289793F638E284ED" X-Trace: dough.gmane.org 1311032916 11733 80.91.229.12 (18 Jul 2011 23:48:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 18 Jul 2011 23:48:36 +0000 (UTC) To: 9119@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 19 01:48:31 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QixY7-0005yw-Fw for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Jul 2011 01:48:31 +0200 Original-Received: from localhost ([::1]:46545 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QixY6-0000Sq-Cz for geb-bug-gnu-emacs@m.gmane.org; Mon, 18 Jul 2011 19:48:30 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:37766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QixXj-0000RX-8j for bug-gnu-emacs@gnu.org; Mon, 18 Jul 2011 19:48:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QixXf-0002nC-96 for bug-gnu-emacs@gnu.org; Mon, 18 Jul 2011 19:48:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41784) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QixXf-0002n7-04 for bug-gnu-emacs@gnu.org; Mon, 18 Jul 2011 19:48:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QixXe-0001Dc-7v; Mon, 18 Jul 2011 19:48:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Colascione Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Jul 2011 23:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 9119 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13110328294620 (code B ref -1); Mon, 18 Jul 2011 23:48:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Jul 2011 23:47:09 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QixWl-0001CT-T2 for submit@debbugs.gnu.org; Mon, 18 Jul 2011 19:47:08 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QixWi-0001Bz-UY for submit@debbugs.gnu.org; Mon, 18 Jul 2011 19:47:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QixWZ-0002cm-N9 for submit@debbugs.gnu.org; Mon, 18 Jul 2011 19:46:59 -0400 Original-Received: from lists.gnu.org ([140.186.70.17]:36200) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QixWZ-0002c8-EE for submit@debbugs.gnu.org; Mon, 18 Jul 2011 19:46:55 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:37670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QixWU-0000HT-SQ for bug-gnu-emacs@gnu.org; Mon, 18 Jul 2011 19:46:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QixWQ-0002br-AR for bug-gnu-emacs@gnu.org; Mon, 18 Jul 2011 19:46:50 -0400 Original-Received: from mail-pv0-f169.google.com ([74.125.83.169]:49113) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QixWP-0002bl-Pa for bug-gnu-emacs@gnu.org; Mon, 18 Jul 2011 19:46:46 -0400 Original-Received: by pvc12 with SMTP id 12so4123281pvc.0 for ; Mon, 18 Jul 2011 16:46:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :x-enigmail-version:openpgp:content-type; bh=onwBk7too+X3gKOA8VNT5y0iA1gzotnL3PE4yc0MBko=; b=m5cXagLdLM0k8KOnl8AdKKHtxdCDBvl73uCLgA9z4+FWog28LdOSpyOHByDerwomce gX2p3RkZfRIQ/DIdhaUkYBK99tmPsmwbdoV2XcabGCC12M85d7Ys+UitDbetlIxWEUz3 KBbk5dbKibY8ZaN7aNTJvzS15c3zRUup+bSsg= Original-Received: by 10.142.163.7 with SMTP id l7mr3162862wfe.36.1311032804479; Mon, 18 Jul 2011 16:46:44 -0700 (PDT) Original-Received: from [0.0.0.0] (c-24-18-179-193.hsd1.wa.comcast.net [24.18.179.193]) by mx.google.com with ESMTPS id o15sm3858838wff.19.2011.07.18.16.46.42 (version=SSLv3 cipher=OTHER); Mon, 18 Jul 2011 16:46:43 -0700 (PDT) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 X-Enigmail-Version: 1.2 OpenPGP: id=5035D15B X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 18 Jul 2011 19:48:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:49426 Archived-At: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig15ED011E289793F638E284ED Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable The warnings were annoying me. =3D=3D=3D modified file 'src/ChangeLog' --- src/ChangeLog 2011-07-18 20:32:34 +0000 +++ src/ChangeLog 2011-07-18 23:38:06 +0000 @@ -1,5 +1,7 @@ 2011-07-18 Daniel Colascione + * gmalloc.c: modernize function definitions throughout. 2011-07-18 Paul Eggert =3D=3D=3D modified file 'src/gmalloc.c' --- src/gmalloc.c 2011-05-28 22:39:39 +0000 +++ src/gmalloc.c 2011-07-18 23:38:06 +0000 @@ -485,8 +485,7 @@ /* Aligned allocation. */ static __ptr_t align PP ((__malloc_size_t)); static __ptr_t -align (size) - __malloc_size_t size; +align (__malloc_size_t size) { __ptr_t result; unsigned long int adj; @@ -520,9 +519,8 @@ If we cannot get space at END, fail and return 0. */ static __ptr_t get_contiguous_space PP ((__malloc_ptrdiff_t, __ptr_t)); static __ptr_t -get_contiguous_space (size, position) - __malloc_ptrdiff_t size; - __ptr_t position; +get_contiguous_space (__malloc_ptrdiff_t size, + __ptr_t position) { __ptr_t before; __ptr_t after; @@ -578,21 +576,21 @@ int _malloc_thread_enabled_p; static void -malloc_atfork_handler_prepare () +malloc_atfork_handler_prepare (void) { LOCK (); LOCK_ALIGNED_BLOCKS (); } static void -malloc_atfork_handler_parent () +malloc_atfork_handler_parent (void) { UNLOCK_ALIGNED_BLOCKS (); UNLOCK (); } static void -malloc_atfork_handler_child () +malloc_atfork_handler_child (void) { UNLOCK_ALIGNED_BLOCKS (); UNLOCK (); @@ -600,7 +598,7 @@ /* Set up mutexes and make malloc etc. thread-safe. */ void -malloc_enable_thread () +malloc_enable_thread (void) { if (_malloc_thread_enabled_p) return; @@ -619,7 +617,7 @@ #endif static void -malloc_initialize_1 () +malloc_initialize_1 (void) { #ifdef GC_MCHECK mcheck (NULL); @@ -650,7 +648,7 @@ main will call malloc which calls this function. That is before any threads or signal handlers has been set up, so we don't need thread protection. */ int -__malloc_initialize () +__malloc_initialize (void) { if (__malloc_initialized) return 0; @@ -666,8 +664,7 @@ growing the heap info table as necessary. */ static __ptr_t morecore_nolock PP ((__malloc_size_t)); static __ptr_t -morecore_nolock (size) - __malloc_size_t size; +morecore_nolock (__malloc_size_t size) { __ptr_t result; malloc_info *newinfo, *oldinfo; @@ -780,8 +777,7 @@ /* Allocate memory from the heap. */ __ptr_t -_malloc_internal_nolock (size) - __malloc_size_t size; +_malloc_internal_nolock (__malloc_size_t size) { __ptr_t result; __malloc_size_t block, blocks, lastblocks, start; @@ -980,8 +976,7 @@ } __ptr_t -_malloc_internal (size) - __malloc_size_t size; +_malloc_internal (__malloc_size_t size) { __ptr_t result; @@ -993,8 +988,7 @@ } __ptr_t -malloc (size) - __malloc_size_t size; +malloc (__malloc_size_t size) { __ptr_t (*hook) (__malloc_size_t); @@ -1019,23 +1013,19 @@ and _realloc. Make them use the GNU functions. */ __ptr_t -_malloc (size) - __malloc_size_t size; +_malloc (__malloc_size_t size) { return malloc (size); } void -_free (ptr) - __ptr_t ptr; +_free (__ptr_t ptr) { free (ptr); } __ptr_t -_realloc (ptr, size) - __ptr_t ptr; - __malloc_size_t size; +_realloc (__ptr_t ptr, __malloc_size_t size) { return realloc (ptr, size); } @@ -1341,8 +1331,7 @@ /* Return memory to the heap. Like `free' but don't call a __free_hook if there is one. */ void -_free_internal (ptr) - __ptr_t ptr; +_free_internal (__ptr_t ptr) { LOCK (); _free_internal_nolock (ptr); @@ -1352,8 +1341,7 @@ /* Return memory to the heap. */ void -free (ptr) - __ptr_t ptr; +free (__ptr_t ptr) { void (*hook) (__ptr_t) =3D __free_hook; @@ -1368,8 +1356,7 @@ weak_alias (free, cfree) #else void -cfree (ptr) - __ptr_t ptr; +cfree (__ptr_t ptr) { free (ptr); } @@ -1417,10 +1404,9 @@ /* Like bcopy except never gets confused by overlap. */ void -__malloc_safe_bcopy (afrom, ato, size) - __ptr_t afrom; - __ptr_t ato; - __malloc_size_t size; +__malloc_safe_bcopy (__ptr_t afrom, + __ptr_t ato, + __malloc_size_t size) { char *from =3D afrom, *to =3D ato; @@ -1493,9 +1479,7 @@ new region. This module has incestuous knowledge of the internals of both free and malloc. */ __ptr_t -_realloc_internal_nolock (ptr, size) - __ptr_t ptr; - __malloc_size_t size; +_realloc_internal_nolock (__ptr_t ptr, __malloc_size_t size) { __ptr_t result; int type; @@ -1611,9 +1595,8 @@ } __ptr_t -_realloc_internal (ptr, size) - __ptr_t ptr; - __malloc_size_t size; +_realloc_internal (__ptr_t ptr, + __malloc_size_t size) { __ptr_t result; @@ -1625,9 +1608,8 @@ } __ptr_t -realloc (ptr, size) - __ptr_t ptr; - __malloc_size_t size; +realloc (__ptr_t ptr, + __malloc_size_t size) { __ptr_t (*hook) (__ptr_t, __malloc_size_t); @@ -1665,9 +1647,8 @@ /* Allocate an array of NMEMB elements each SIZE bytes long. The entire array is initialized to zeros. */ __ptr_t -calloc (nmemb, size) - register __malloc_size_t nmemb; - register __malloc_size_t size; +calloc (register __malloc_size_t nmemb, + register __malloc_size_t size) { register __ptr_t result =3D malloc (nmemb * size); @@ -1719,8 +1700,7 @@ and return the start of data space, or NULL on errors. If INCREMENT is negative, shrink data space. */ __ptr_t -__default_morecore (increment) - __malloc_ptrdiff_t increment; +__default_morecore (__malloc_ptrdiff_t increment) { __ptr_t result; #if defined(CYGWIN) @@ -1760,9 +1740,8 @@ __malloc_size_t __alignment)); __ptr_t -memalign (alignment, size) - __malloc_size_t alignment; - __malloc_size_t size; +memalign (__malloc_size_t alignment, + __malloc_size_t size) { __ptr_t result; unsigned long int adj, lastadj; @@ -1843,10 +1822,9 @@ #endif int -posix_memalign (memptr, alignment, size) - __ptr_t *memptr; - __malloc_size_t alignment; - __malloc_size_t size; +posix_memalign (__ptr_t *memptr, + __malloc_size_t alignment, + __malloc_size_t size) { __ptr_t mem; @@ -1917,8 +1895,7 @@ static __malloc_size_t pagesize; __ptr_t -valloc (size) - __malloc_size_t size; +valloc (__malloc_size_t size) { if (pagesize =3D=3D 0) pagesize =3D __getpagesize (); @@ -2001,8 +1978,7 @@ static enum mcheck_status checkhdr (const struct hdr *); static enum mcheck_status -checkhdr (hdr) - const struct hdr *hdr; +checkhdr (const struct hdr *hdr) { enum mcheck_status status; switch (hdr->magic) @@ -2025,10 +2001,8 @@ return status; } -static void freehook (__ptr_t); static void -freehook (ptr) - __ptr_t ptr; +freehook (__ptr_t ptr) { struct hdr *hdr; @@ -2047,10 +2021,8 @@ __free_hook =3D freehook; } -static __ptr_t mallochook (__malloc_size_t); static __ptr_t -mallochook (size) - __malloc_size_t size; +mallochook (__malloc_size_t size) { struct hdr *hdr; @@ -2067,11 +2039,9 @@ return (__ptr_t) (hdr + 1); } -static __ptr_t reallochook (__ptr_t, __malloc_size_t); static __ptr_t -reallochook (ptr, size) - __ptr_t ptr; - __malloc_size_t size; +reallochook (__ptr_t ptr, + __malloc_size_t size) { struct hdr *hdr =3D NULL; __malloc_size_t osize =3D 0; @@ -2105,8 +2075,7 @@ } static void -mabort (status) - enum mcheck_status status; +mabort (enum mcheck_status status) { const char *msg; switch (status) @@ -2139,8 +2108,7 @@ static int mcheck_used =3D 0; int -mcheck (func) - void (*func) (enum mcheck_status); +mcheck (void (*func) (enum mcheck_status)) { abortfunc =3D (func !=3D NULL) ? func : &mabort; --------------enig15ED011E289793F638E284ED Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk4kxeAACgkQ17c2LVA10VtT3QCeJP2taquRKoD2uPGHANqpYZcE 7oMAoKchVxj0IQe/BU+o3+LpNrm+7WeR =yJ3Z -----END PGP SIGNATURE----- --------------enig15ED011E289793F638E284ED--