summaryrefslogtreecommitdiff
path: root/libparted/exception.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-02-12 23:35:30 +0100
committerOtavio Salvador <otavio@ossystems.com.br>2007-02-13 09:20:39 -0200
commit64f61abbcaefe060433196e323eba251bfc6e17e (patch)
treed28bae3d7f7c2dd6d8c279bd43a7063929336b68 /libparted/exception.c
parenteff7c75fbe7348e20fde39f0f02dc9613ccd7afc (diff)
downloadparted-64f61abbcaefe060433196e323eba251bfc6e17e.tar.gz
Compile warning-free with "gcc -Wall -Wshadow".
Hello, I find that keeping code warning-free (wrt gcc -Wall -Wshadow) makes it easier to avoid certain classes of bugs. Compiling with gcc -Wall -Wshadow evoked a few warnings on a Debian/unstable system. Here are patches to fix those: * libparted/exception.c (default_handler): Rename parameter "ex" to "e", to avoid shadowing file-scoped global. * libparted/fs/linux_swap/linux_swap.c (_generic_swap_probe): Add a "can't happen" (with current callers) "default: goto error" clause in a switch to avoid a may-be-used-uninitialized warning. (_generic_swap_clobber): Likewise. * libparted/fs/hfs/reloc_plus.c (hfsplus_pack_free_space_from_block): Rename local variable "div" to "divisor", to avoid shadowing the function in <stdlib.h>. * libparted/fs/hfs/reloc.c (hfs_pack_free_space_from_block): Likewise. * libparted/fs/hfs/cache.c (hfsc_cache_add_extent): Rename parameter "index" to "ref_index" to avoid shadowing the <string.h> function. * libparted/labels/sun.c (sun_partition_enumerate): Rename local variable "i" to "j", to avoid shadowing another local. Signed-off-by: Jim Meyering <jim@meyering.net>
Diffstat (limited to 'libparted/exception.c')
-rw-r--r--libparted/exception.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libparted/exception.c b/libparted/exception.c
index 8b8b306..798e69c 100644
--- a/libparted/exception.c
+++ b/libparted/exception.c
@@ -1,6 +1,6 @@
/*
libparted - a library for manipulating disk partitions
- Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -126,9 +126,9 @@ ped_exception_get_option_string (PedExceptionOption ex_opt)
}
static PedExceptionOption
-default_handler (PedException* ex)
+default_handler (PedException* e)
{
- if (ex->type == PED_EXCEPTION_BUG)
+ if (e->type == PED_EXCEPTION_BUG)
fprintf (stderr,
_("A bug has been detected in GNU Parted. "
"Refer to the web site of parted "
@@ -141,14 +141,14 @@ default_handler (PedException* ex)
VERSION);
else
fprintf (stderr, "%s: ",
- ped_exception_get_type_string (ex->type));
- fprintf (stderr, "%s\n", ex->message);
+ ped_exception_get_type_string (e->type));
+ fprintf (stderr, "%s\n", e->message);
- switch (ex->options) {
+ switch (e->options) {
case PED_EXCEPTION_OK:
case PED_EXCEPTION_CANCEL:
case PED_EXCEPTION_IGNORE:
- return ex->options;
+ return e->options;
default:
return PED_EXCEPTION_UNHANDLED;