Gentoo Archives: gentoo-dev

From: Richard Freeman <rich@××××××××××××××.net>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Opinions Wanted - Arrays again :)
Date: Fri, 26 Oct 2007 10:19:43
Message-Id: 4721BE92.4070200@thefreemanclan.net
In Reply to: Re: [gentoo-dev] Opinions Wanted - Arrays again :) by Roy Marples
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA1
3
4 Roy Marples wrote:
5 >>> 0_config_eth0="1.2.3.4 netmask 5.6.7.8;"
6 >>> 1_config_eth0="\*"
7 >>> 2_config_eth0="'host.name' netmask 1.2.3.4"
8 >>> 3_config_eth0="-I 'option; $FOO with spaces'"
9 >> I was hoping for some sort of meaningfully named separate variables, not
10 >> an even messier fake array.
11 >
12 > I'm all ears for any other suggestions :)
13 >
14
15 If there is some problem with this suggestion feel free to shoot it full
16 of holes, but how about something like:
17
18 address_eth0="1.2.3.4"
19 netmask_eth0="255.255.255.0"
20 broadcast_eth0="1.2.3.255"
21 gateway_eth0="1.2.3.1"
22 network_eth0="1.2.3.0"
23 hostname_eth0="mypc"
24 options_eth0="bells and whistles"
25
26 Without digging through the original source I'm not sure what everything
27 else in that array is, but I think you get the picture. Instead of
28 sticking all these parameters into a big array why not break them down
29 into what they actually are used for? This should also make the code
30 that actually reads back these variables a lot more readable - instead
31 of wondering what the 5th field in the array is you would see something
32 meaningful like "netmask".
33
34 Again, if I'm missing some reason why this wouldn't work feel free to
35 point it out. :)
36 -----BEGIN PGP SIGNATURE-----
37 Version: GnuPG v1.4.7 (GNU/Linux)
38 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
39
40 iD8DBQFHIb6OG4/rWKZmVWkRAhvzAJ0eoNK8I73+HU3tVRnJzFMJwYKSqQCgqzoW
41 j71E+DxgfrGTRSwKWgCmW40=
42 =qitq
43 -----END PGP SIGNATURE-----

Attachments

File name MIME type
smime.p7s application/x-pkcs7-signature

Replies

Subject Author
Re: [gentoo-dev] Opinions Wanted - Arrays again :) Roy Marples <uberlord@g.o>