You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
3.5 KiB
106 lines
3.5 KiB
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|
# |
|
# Filename: package/.../paxctl/patches/glibc-2.5-iconv_unnest-1.patch |
|
# Copyright (C) 2008 The OpenSDE Project |
|
# |
|
# More information can be found in the files COPYING and README. |
|
# |
|
# This patch file is dual-licensed. It is available under the license the |
|
# patched project is licensed under, as long as it is an OpenSource license |
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms |
|
# of the GNU General Public License as published by the Free Software |
|
# Foundation; either version 2 of the License, or (at your option) any later |
|
# version. |
|
# --- SDE-COPYRIGHT-NOTE-END --- |
|
|
|
Submitted By: Robert Connolly <robert at linuxfromscratch dot org> (ashes) |
|
Date: 2006-10-11 |
|
Initial Package Version: 2.5 |
|
Upstream Status: Submitted - http://sources.redhat.com/bugzilla/show_bug.cgi?id=3350 |
|
Origin: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/glibc/2.3.5/\ |
|
4010_all_2.3.5-hardened-iconvconfig-unnest.patch |
|
Description: Move nested function to a static one so we avoid generating a trampoline. |
|
|
|
diff -Naur glibc-2.5.orig/iconv/iconvconfig.c glibc-2.5/iconv/iconvconfig.c |
|
--- glibc-2.5.orig/iconv/iconvconfig.c 2006-09-21 03:57:30.000000000 +0000 |
|
+++ glibc-2.5/iconv/iconvconfig.c 2006-10-11 21:36:18.000000000 +0000 |
|
@@ -1011,6 +1011,38 @@ |
|
module name offset |
|
(following last entry with step count 0) |
|
*/ |
|
+ |
|
+/* Function to insert the names. */ |
|
+/* Made non-nested to avoid trampoline. |
|
+ * Requires hash_table and hash_size to be made global, |
|
+ * but since the caller (write_output) is called once |
|
+ * in the only thread there should be no problem */ |
|
+static struct hash_entry *hash_table; |
|
+static size_t hash_size; |
|
+static void |
|
+name_insert (const void *nodep, VISIT value, int level) |
|
+ { |
|
+ struct name *name; |
|
+ unsigned int idx; |
|
+ unsigned int hval2; |
|
+ |
|
+ if (value != leaf && value != postorder) |
|
+ return; |
|
+ |
|
+ name = *(struct name **) nodep; |
|
+ idx = name->hashval % hash_size; |
|
+ hval2 = 1 + name->hashval % (hash_size - 2); |
|
+ |
|
+ while (hash_table[idx].string_offset != 0) |
|
+ if ((idx += hval2) >= hash_size) |
|
+ idx -= hash_size; |
|
+ |
|
+ hash_table[idx].string_offset = strtaboffset (name->strent); |
|
+ |
|
+ assert (name->module_idx != -1); |
|
+ hash_table[idx].module_idx = name->module_idx; |
|
+ } |
|
+ |
|
static int |
|
write_output (void) |
|
{ |
|
@@ -1018,8 +1050,6 @@ |
|
char *string_table; |
|
size_t string_table_size; |
|
struct gconvcache_header header; |
|
- struct hash_entry *hash_table; |
|
- size_t hash_size; |
|
struct module_entry *module_table; |
|
char *extra_table; |
|
char *cur_extra_table; |
|
@@ -1032,30 +1062,6 @@ |
|
char tmpfname[(output_file == NULL ? sizeof finalname : output_file_len + 1) |
|
+ strlen (".XXXXXX")]; |
|
|
|
- /* Function to insert the names. */ |
|
- auto void |
|
- name_insert (const void *nodep, VISIT value, int level) |
|
- { |
|
- struct name *name; |
|
- unsigned int idx; |
|
- unsigned int hval2; |
|
- |
|
- if (value != leaf && value != postorder) |
|
- return; |
|
- |
|
- name = *(struct name **) nodep; |
|
- idx = name->hashval % hash_size; |
|
- hval2 = 1 + name->hashval % (hash_size - 2); |
|
- |
|
- while (hash_table[idx].string_offset != 0) |
|
- if ((idx += hval2) >= hash_size) |
|
- idx -= hash_size; |
|
- |
|
- hash_table[idx].string_offset = strtaboffset (name->strent); |
|
- |
|
- assert (name->module_idx != -1); |
|
- hash_table[idx].module_idx = name->module_idx; |
|
- } |
|
|
|
/* Open the output file. */ |
|
if (output_file == NULL)
|
|
|