aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2013-02-05 12:15:56 -0800
committerRoland McGrath <roland@hack.frob.com>2013-02-05 12:15:56 -0800
commit573c29b288d5cb88f3a09b9b7b5bcf0db762fd5d (patch)
tree0c758f76d127c02a0f255795d535499e9df386d5
parentb2e25af00c4b6268624a06472477112fc015e7d8 (diff)
downloadglibc-573c29b288d5cb88f3a09b9b7b5bcf0db762fd5d.zip
glibc-573c29b288d5cb88f3a09b9b7b5bcf0db762fd5d.tar.gz
glibc-573c29b288d5cb88f3a09b9b7b5bcf0db762fd5d.tar.bz2
Replace an alloca use with a variable-length array.
-rw-r--r--ChangeLog3
-rw-r--r--elf/dl-hwcaps.c5
2 files changed, 5 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 1661df9..818edb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2013-02-05 Roland McGrath <roland@hack.frob.com>
+ * elf/dl-hwcaps.c (_dl_important_hwcaps): Use a variable-length array
+ instead of calling alloca.
+
* io/lseek.c (__lseek): Rename to __libc_lseek.
Define __lseek as an alias.
diff --git a/elf/dl-hwcaps.c b/elf/dl-hwcaps.c
index 3805949..d3214e5 100644
--- a/elf/dl-hwcaps.c
+++ b/elf/dl-hwcaps.c
@@ -42,7 +42,6 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
size_t cnt = platform != NULL;
size_t n, m;
size_t total;
- struct r_strlenpair *temp;
struct r_strlenpair *result;
struct r_strlenpair *rp;
char *cp;
@@ -103,7 +102,7 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
++cnt;
/* Create temporary data structure to generate result table. */
- temp = (struct r_strlenpair *) alloca (cnt * sizeof (*temp));
+ struct r_strlenpair temp[cnt];
m = 0;
#if defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO
if (dsocaps != NULL)
@@ -199,7 +198,7 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
}
/* Fill in the information. This follows the following scheme
- (indeces from TEMP for four strings):
+ (indices from TEMP for four strings):
entry #0: 0, 1, 2, 3 binary: 1111
#1: 0, 1, 3 1101
#2: 0, 2, 3 1011