[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#16370: [PATCH] parted: don't reload partition table on every command
From: |
Phillip Susi |
Subject: |
bug#16370: [PATCH] parted: don't reload partition table on every command |
Date: |
Mon, 03 Mar 2014 19:46:21 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
On 03/03/2014 03:06 PM, Brian C. Lane wrote:
> On Sun, Jan 05, 2014 at 11:03:55PM -0500, Phillip Susi wrote:
>> Command* command_create (const StrList* names, - int (*method)
>> (PedDevice** dev), + int (*method) (PedDevice** dev, PedDisk**
>> disk),
>
> May as well call the argument diskp everywhere to be consistent.
Good point.
>> @@ -1274,11 +1270,15 @@ static int _print_list () { PedDevice
>> *current_dev = NULL; + PedDisk *disk = 0;
>
> Why do you use 0 instead of NULL? To me seeing a 0 makes me think
> it is supposed to have a value whereas NULL makes it clear it is
> uninitialized.
Because programmers are notoriously lazy typists ;)
Also at least at some time in the past on certain compilers in C++,
NULL could cause errors where 0 wouldn't so I guess I got into the habit.
I suppose I can change it since I'm making changes anyhow.
>> - disk = ped_disk_new (*dev); - if (!disk) +
>> if (*disk == 0)
>
> No need to use == 0 here.
I suppose !*disk works too, though it's a bit less readable.
>> static void -_done (PedDevice* dev) +_done (PedDevice* dev,
>> PedDisk* disk) { +if (disk) + ped_disk_destroy (disk); if
>> (dev->boot_dirty && dev->type != PED_DEVICE_FILE) {
>> ped_exception_throw ( PED_EXCEPTION_WARNING,
>
> Looks like _done could use some indentation fixes, may as well
> clean it up while you're changing it.
I didn't want the diff being larger than needed, but yea, it should be
fixed while I'm in the area.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBCgAGBQJTFSJcAAoJEI5FoCIzSKrwdGwH/Rn8XAbq84BGR2i70tdGas1Q
sBhQxmUEBgSzdT8GG1GmErZVj3jINNO72TP9e+q6+9Kx5slVvt+mRHgXttN3317s
3fGLgCWBgrgsIkOih6dBqib5qxGYrghcJj3id/5q4K0zF2hREJ89dP53gv1h15vt
unpRjfvEsJTpnC/hC5wvLV2pXQqf0LOlSVgJn0isckyGp2SOo8JkmCpLBt+wk+kP
qhp1wcjl7Vb0nq9JRJmvdK2ZS8aXJJpuENPFx0v627tRSq8vqmwWukF6TlVTkIqT
Ld2x+0pPIVtC8Oomh3aAdv0ZR+R2t3ZI21EWhpJNgC0vyFfG7oI8pjov1swQoAU=
=cIMY
-----END PGP SIGNATURE-----