From: Ben Elliston <bje@au1.ibm.com>
To: Alan Modra <amodra@bigpond.net.au>
Cc: binutils@sourceware.org
Subject: Re: PATCH: off-by-one error in gas/sb.c
Date: Tue, 02 May 2006 03:38:00 -0000 [thread overview]
Message-ID: <20060502033936.GA2573@ozlabs.au.ibm.com> (raw)
In-Reply-To: <20060502025035.GG11597@bubble.grove.modra.org>
> OK. While you're at it, move the sb_list_vector typedef from sb.h
> to sb.c to make the size assertion really obvious.
Here's what I'm comitting. Thanks.
2006-05-02 Ben Elliston <bje@au.ibm.com>
* sb.h (sb_list_vector): Move to sb.c.
* sb.c (free_list): Use type of sb_list_vector directly.
(sb_build): Fix off-by-one error in assertion about `size'.
Index: sb.h
===================================================================
RCS file: /cvs/src/src/gas/sb.h,v
retrieving revision 1.12
diff -u -p -r1.12 sb.h
--- sb.h 18 May 2005 05:40:07 -0000 1.12
+++ sb.h 2 May 2006 03:35:15 -0000
@@ -70,14 +70,6 @@ typedef struct le
}
sb_element;
-/* The free list. */
-
-typedef struct
-{
- sb_element *size[sb_max_power_two];
-}
-sb_list_vector;
-
extern void sb_new (sb *);
extern void sb_kill (sb *);
extern void sb_add_sb (sb *, sb *);
Index: sb.c
===================================================================
RCS file: /cvs/src/src/gas/sb.c,v
retrieving revision 1.12
diff -u -p -r1.12 sb.c
--- sb.c 18 May 2005 05:40:07 -0000 1.12
+++ sb.c 2 May 2006 03:35:15 -0000
@@ -56,7 +56,10 @@ static void sb_check (sb *, int);
static int string_count[sb_max_power_two];
/* Free list of sb structures. */
-static sb_list_vector free_list;
+static struct
+{
+ sb_element *size[sb_max_power_two];
+} free_list;
/* Initializes an sb. */
@@ -66,8 +69,7 @@ sb_build (sb *ptr, int size)
/* See if we can find one to allocate. */
sb_element *e;
- if (size > sb_max_power_two)
- abort ();
+ assert (size < sb_max_power_two);
e = free_list.size[size];
if (!e)
prev parent reply other threads:[~2006-05-02 3:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-02 1:44 Ben Elliston
2006-05-02 1:45 ` Ben Elliston
2006-05-02 2:50 ` Alan Modra
2006-05-02 3:38 ` Ben Elliston [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060502033936.GA2573@ozlabs.au.ibm.com \
--to=bje@au1.ibm.com \
--cc=amodra@bigpond.net.au \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).