blob: 7ba8564aebbf9c5d242c9d9a12e0748beddee3bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mageia-dev] [soft-commits] [3964] Fix partition numbering on GPT (mga#3091)
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mageia-dev%40mageia.org?Subject=Re%3A%20%5BMageia-dev%5D%20%5Bsoft-commits%5D%20%5B3964%5D%20Fix%20partition%20numbering%20on%0A%20GPT%20%28mga%233091%29&In-Reply-To=%3C4F7EAAB1.4070709%40gmail.com%3E">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="013940.html">
<LINK REL="Next" HREF="013944.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mageia-dev] [soft-commits] [3964] Fix partition numbering on GPT (mga#3091)</H1>
<B>Guillaume Rousse</B>
<A HREF="mailto:mageia-dev%40mageia.org?Subject=Re%3A%20%5BMageia-dev%5D%20%5Bsoft-commits%5D%20%5B3964%5D%20Fix%20partition%20numbering%20on%0A%20GPT%20%28mga%233091%29&In-Reply-To=%3C4F7EAAB1.4070709%40gmail.com%3E"
TITLE="[Mageia-dev] [soft-commits] [3964] Fix partition numbering on GPT (mga#3091)">guillomovitch at gmail.com
</A><BR>
<I>Fri Apr 6 10:34:57 CEST 2012</I>
<P><UL>
<LI>Previous message: <A HREF="013940.html">[Mageia-dev] [soft-commits] [3964] Fix partition numbering on GPT (mga#3091)
</A></li>
<LI>Next message: <A HREF="013944.html">[Mageia-dev] [soft-commits] [3964] Fix partition numbering on GPT (mga#3091)
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#13943">[ date ]</a>
<a href="thread.html#13943">[ thread ]</a>
<a href="subject.html#13943">[ subject ]</a>
<a href="author.html#13943">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Le 06/04/2012 09:58, Thierry Vignaud a écrit :
><i> On 6 April 2012 00:00,<<A HREF="https://www.mageia.org/mailman/listinfo/mageia-dev">root at mageia.org</A>> wrote:
</I>>><i> Fix partition numbering on GPT (mga#3091)
</I>><i>
</I>><i> (...)
</I>><i>
</I>>><i> @@ -27,9 +28,20 @@
</I>>><i> $p{start} = $5;
</I>>><i> $p{size} = $7;
</I>>><i> }
</I>>><i> - \%p;
</I>>><i> + $p{part_number} => \%p;
</I>>><i> } c::get_disk_partitions($hd->{file});
</I>>><i>
</I>>><i> + my @pt = map {
</I>>><i> + my $part_number = $_;
</I>>><i> + if ($parts{$part_number}) {
</I>>><i> + $parts{$part_number};
</I>>><i> + } else {
</I>>><i> + my %p;
</I>>><i> + $p{part_number} = $part_number;
</I>>><i> + \%p;
</I>><i>
</I>><i> This is simpler& more readable:
</I>><i>
</I>><i> { part_number => $part_number };
</I>><i>
</I>><i> anyway it would be maybe simpler go one of the way I attach.
</I>><i> WDYT?
</I>I like the 'simpler' adjective when I have to read this stuff at least 3
times to get an idea of what it happening... A simple comment wouldn't
hurt there.
Anyway, allocating the list content in a single pass seems simpler to
understand for me. I'd rather use something as:
# create an exhaustive list including %parts content if existing
# for given partition number, a default structure otherwise
my @pt = map {
$parts{$_} ? $parts{$_} : { part_number => $_ }
} 1..$nb_primary;
More general remarks:
What about using consistent variable names ? If you have a collection of
'something' stored in a hash, why should it suddenly became of
collection of 'st' when transfering them into an array ? Or using a
consistent format for variables storing numbers, rather than having both
nb_foo and bar_number ?
And I don't underestand the interest of using an hash for storing
content with numerical indexes only. Especially if you have to convert
it to an array at the end...
--
BOFH excuse #79:
Look, buddy: Windows 3.1 IS A General Protection Fault.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="013940.html">[Mageia-dev] [soft-commits] [3964] Fix partition numbering on GPT (mga#3091)
</A></li>
<LI>Next message: <A HREF="013944.html">[Mageia-dev] [soft-commits] [3964] Fix partition numbering on GPT (mga#3091)
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#13943">[ date ]</a>
<a href="thread.html#13943">[ thread ]</a>
<a href="subject.html#13943">[ subject ]</a>
<a href="author.html#13943">[ author ]</a>
</LI>
</UL>
<hr>
<a href="https://www.mageia.org/mailman/listinfo/mageia-dev">More information about the Mageia-dev
mailing list</a><br>
</body></html>
|