mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
Avoid various "declaration of <var> shadows a previous local"
I enabled the -Wshadow warning temporarily in order to do these fixes, but had to disable it again afterwards. The reason is that this warns about shadowing globals, which is sort of a good thing, but because we have a global called "verbose" just about everywhere, and at the same time we baked a function argument called "verbose" into several unchangable APIs, well, we're stuck without being able to use this warning.
This commit is contained in:
@@ -35,13 +35,13 @@
|
||||
if (code == AUG_ENOMEM) \
|
||||
reply_with_error (fs ": augeas out of memory", ##__VA_ARGS__); \
|
||||
else { \
|
||||
const char *message = aug_error_message (aug); \
|
||||
const char *minor = aug_error_minor_message (aug); \
|
||||
const char *details = aug_error_details (aug); \
|
||||
const char *aug_err_message = aug_error_message (aug); \
|
||||
const char *aug_err_minor = aug_error_minor_message (aug); \
|
||||
const char *aug_err_details = aug_error_details (aug); \
|
||||
fprintf (stderr, fs ": %s%s%s%s%s", ##__VA_ARGS__, \
|
||||
message, \
|
||||
minor ? ": " : "", minor ? minor : "", \
|
||||
details ? ": " : "", details ? details : ""); \
|
||||
aug_err_message, \
|
||||
aug_err_minor ? ": " : "", aug_err_minor ? aug_err_minor : "", \
|
||||
aug_err_details ? ": " : "", aug_err_details ? aug_err_details : ""); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
@@ -511,7 +511,7 @@ do_btrfs_subvolume_list (const mountable_t *fs)
|
||||
goto error;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < nr_subvolumes; ++i) {
|
||||
for (i = 0; i < nr_subvolumes; ++i) {
|
||||
/* To avoid allocations, reuse the 'line' buffer to store the
|
||||
* path. Thus we don't need to free 'line', since it will be
|
||||
* freed by the calling (XDR) code.
|
||||
|
||||
@@ -117,14 +117,14 @@ do_mkfs (const char *fstype, const char *device, int blocksize,
|
||||
* have to determine the block device sector size in order to do
|
||||
* this.
|
||||
*/
|
||||
int sectorsize = do_blockdev_getss (device);
|
||||
if (sectorsize == -1)
|
||||
int ss = do_blockdev_getss (device);
|
||||
if (ss == -1)
|
||||
return -1;
|
||||
|
||||
int sectors_per_cluster = blocksize / sectorsize;
|
||||
int sectors_per_cluster = blocksize / ss;
|
||||
if (sectors_per_cluster < 1 || sectors_per_cluster > 128) {
|
||||
reply_with_error ("unsupported cluster size for %s filesystem (requested cluster size = %d, sector size = %d, trying sectors per cluster = %d)",
|
||||
fstype, blocksize, sectorsize, sectors_per_cluster);
|
||||
fstype, blocksize, ss, sectors_per_cluster);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ guestfs_int_call_callbacks_message (guestfs_h *g, uint64_t event,
|
||||
event == GUESTFS_EVENT_WARNING ||
|
||||
event == GUESTFS_EVENT_TRACE)) {
|
||||
bool from_appliance = event == GUESTFS_EVENT_APPLIANCE;
|
||||
size_t i, i0;
|
||||
size_t i0;
|
||||
|
||||
/* APPLIANCE => <buf>
|
||||
* LIBRARY => libguestfs: <buf>\n
|
||||
|
||||
@@ -451,7 +451,6 @@ check_windows_system_registry (guestfs_h *g, struct inspect_fs *fs)
|
||||
/* Get the binary value. Is it a fixed disk? */
|
||||
CLEANUP_FREE char *blob = NULL;
|
||||
char *device;
|
||||
size_t len;
|
||||
int64_t type;
|
||||
|
||||
type = guestfs_hivex_value_type (g, v);
|
||||
|
||||
@@ -718,7 +718,6 @@ launch_direct (guestfs_h *g, void *datav, const char *arg)
|
||||
if (g->recovery_proc) {
|
||||
r = fork ();
|
||||
if (r == 0) {
|
||||
int i;
|
||||
struct sigaction sa;
|
||||
pid_t qemu_pid = data->pid;
|
||||
pid_t parent_pid = getppid ();
|
||||
|
||||
@@ -350,7 +350,6 @@ launch_uml (guestfs_h *g, void *datav, const char *arg)
|
||||
if (g->recovery_proc) {
|
||||
r = fork ();
|
||||
if (r == 0) {
|
||||
int i;
|
||||
struct sigaction sa;
|
||||
pid_t vmlinux_pid = data->pid;
|
||||
pid_t parent_pid = getppid ();
|
||||
|
||||
@@ -174,14 +174,14 @@ check_daemon_socket (guestfs_h *g)
|
||||
|
||||
/* Read and process progress messages that happen during FileIn. */
|
||||
if (flag == GUESTFS_PROGRESS_FLAG) {
|
||||
char buf[PROGRESS_MESSAGE_SIZE];
|
||||
char mbuf[PROGRESS_MESSAGE_SIZE];
|
||||
guestfs_progress message;
|
||||
|
||||
n = g->conn->ops->read_data (g, g->conn, buf, PROGRESS_MESSAGE_SIZE);
|
||||
n = g->conn->ops->read_data (g, g->conn, mbuf, PROGRESS_MESSAGE_SIZE);
|
||||
if (n <= 0) /* 0 or -1 */
|
||||
return n;
|
||||
|
||||
xdrmem_create (&xdr, buf, PROGRESS_MESSAGE_SIZE, XDR_DECODE);
|
||||
xdrmem_create (&xdr, mbuf, PROGRESS_MESSAGE_SIZE, XDR_DECODE);
|
||||
xdr_guestfs_progress (&xdr, &message);
|
||||
xdr_destroy (&xdr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user