diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-07-23 05:05:52 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-07-23 05:05:52 +0000 |
commit | 44706ffcf10895abd78cddbd38ab3843d4594462 (patch) | |
tree | 689bf21a1861138be3d69be7cf35774c2b41dd85 /sys-devel | |
parent | (#99833) Create a manpage with perldoc, install crsh as a symlink. Thanks to ... (diff) | |
download | historical-44706ffcf10895abd78cddbd38ab3843d4594462.tar.gz historical-44706ffcf10895abd78cddbd38ab3843d4594462.tar.bz2 historical-44706ffcf10895abd78cddbd38ab3843d4594462.zip |
touchup code to not call strlen() so much and punt ugly C++/Java style macro
Package-Manager: portage-2.0.51.22-r2
Diffstat (limited to 'sys-devel')
-rw-r--r-- | sys-devel/gcc-config/Manifest | 8 | ||||
-rw-r--r-- | sys-devel/gcc-config/files/wrapper-1.4.6.c | 19 |
2 files changed, 13 insertions, 14 deletions
diff --git a/sys-devel/gcc-config/Manifest b/sys-devel/gcc-config/Manifest index 04314e11d0fe..0cdc0e30eb64 100644 --- a/sys-devel/gcc-config/Manifest +++ b/sys-devel/gcc-config/Manifest @@ -17,12 +17,12 @@ MD5 35bfdc34bf7a621fc41de516b13cb4ea files/gcc-config-1.4.0 14923 MD5 4c31f7f5f8723588a4401dd102061301 files/gcc-config-1.3.10 13549 MD5 e3203a5aa6df669ffa479aeeb7605029 files/wrapper-1.4.5.c 10671 MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-gcc-config-1.3.10-r1 0 -MD5 6002b96b17fc06da1a872ef8032b52d5 files/wrapper-1.4.6.c 10582 +MD5 72557949fda7b1226549291b8f171e15 files/wrapper-1.4.6.c 10568 MD5 c4dd33ad0dcb7135344c428f1155b1ad files/gcc-config-1.3.12 15985 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) -iD8DBQFC2jACgIKl8Uu19MoRAjuGAJ461VeyqJKKvkncLpdvsSJ/SdOqpACfYwEN -OgVDszhBq1Y0bo9dzTEKbuI= -=vnId +iD8DBQFC4dBCgIKl8Uu19MoRAtL7AJ9mMdKaIZZrFMGXcWB85PPLee48AACfVG3H +jaod3ETV/Lay0EqvUn0DlOw= +=WwGq -----END PGP SIGNATURE----- diff --git a/sys-devel/gcc-config/files/wrapper-1.4.6.c b/sys-devel/gcc-config/files/wrapper-1.4.6.c index 5744dfbd9110..5945b652c38a 100644 --- a/sys-devel/gcc-config/files/wrapper-1.4.6.c +++ b/sys-devel/gcc-config/files/wrapper-1.4.6.c @@ -1,8 +1,9 @@ /* * Copyright 1999-2005 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 - * $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/files/wrapper-1.4.6.c,v 1.3 2005/07/07 23:03:40 vapier Exp $ + * $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-config/files/wrapper-1.4.6.c,v 1.4 2005/07/23 05:05:52 vapier Exp $ * Author: Martin Schlemmer <azarah@gentoo.org> + * az's lackey: Mike Frysinger <vapier@gentoo.org> */ #define _REENTRANT @@ -20,15 +21,14 @@ #include <stdarg.h> #include <errno.h> -#define GCC_CONFIG "/usr/bin/gcc-config" -#define ENVD_BASE "/etc/env.d/05gcc" +#define GCC_CONFIG "/usr/bin/gcc-config" +#define ENVD_BASE "/etc/env.d/05gcc" struct wrapper_data { char name[MAXPATHLEN + 1]; char fullname[MAXPATHLEN + 1]; char bin[MAXPATHLEN + 1]; char tmp[MAXPATHLEN + 1]; - char *path; }; @@ -325,8 +325,6 @@ static char **getNewArgv(char **argv, const char *newflagsStr) { return newargv; } -#define lastOfStr(str, n) ((str) + strlen(str) - (n)) - int main(int argc, char *argv[]) { struct wrapper_data *data; @@ -377,11 +375,12 @@ int main(int argc, char *argv[]) /* If this is g{cc,++}{32,64}, we need to add -m{32,64} * otherwise we need to add ${CFLAGS_${ABI}} */ - if(!strcmp(lastOfStr(data->bin, 2), "32") ) { - data->bin[strlen(data->bin) - 2] = '\0'; + size = strlen(data->bin) - 2; + if(!strcmp(data->bin + size, "32") ) { + *(data->bin + size) = '\0'; newargv = getNewArgv(argv, "-m32"); - } else if (!strcmp(lastOfStr(data->bin, 2), "64") ) { - data->bin[strlen(data->bin) - 2] = '\0'; + } else if (!strcmp(data->bin + size, "64") ) { + *(data->bin + size) = '\0'; newargv = getNewArgv(argv, "-m64"); } else if(getenv("ABI")) { char *envar = (char *)malloc(sizeof(char) * (strlen("CFLAGS_") + strlen(getenv("ABI")) + 1 )); |