Skip to content

Commit 44e7e0a

Browse files
author
Laszlo Ersek
committed
compare(): move to "utils.c", rename to compare_strings()
We're going to use compare() from multiple source files, going forward, so move it to "utils.c". While at it, rename it to compare_strings(). No functional changes. Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2124538 Signed-off-by: Laszlo Ersek <[email protected]> Message-Id: <[email protected]> Acked-by: Richard W.M. Jones <[email protected]>
1 parent 1b61fac commit 44e7e0a

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

main.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -372,14 +372,6 @@ set_config_defaults (struct config *config)
372372
config->output.storage = strdup ("/var/tmp");
373373
}
374374

375-
static int
376-
compare (const void *vp1, const void *vp2)
377-
{
378-
char * const *p1 = (char * const *) vp1;
379-
char * const *p2 = (char * const *) vp2;
380-
return strcmp (*p1, *p2);
381-
}
382-
383375
/**
384376
* Get parent device of a partition.
385377
*
@@ -520,9 +512,9 @@ find_all_disks (void)
520512
error (EXIT_FAILURE, errno, "closedir: %s", "/sys/block");
521513

522514
if (all_disks)
523-
qsort (all_disks, nr_disks, sizeof (char *), compare);
515+
qsort (all_disks, nr_disks, sizeof (char *), compare_strings);
524516
if (all_removable)
525-
qsort (all_removable, nr_removable, sizeof (char *), compare);
517+
qsort (all_removable, nr_removable, sizeof (char *), compare_strings);
526518
}
527519

528520
/**
@@ -576,5 +568,5 @@ find_all_interfaces (void)
576568
error (EXIT_FAILURE, errno, "closedir: %s", "/sys/class/net");
577569

578570
if (all_interfaces)
579-
qsort (all_interfaces, nr_interfaces, sizeof (char *), compare);
571+
qsort (all_interfaces, nr_interfaces, sizeof (char *), compare_strings);
580572
}

p2v.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ extern char *get_blockdev_serial (const char *dev);
128128
extern char *get_if_addr (const char *if_name);
129129
extern char *get_if_vendor (const char *if_name, int truncate);
130130
extern void wait_network_online (const struct config *);
131+
extern int compare_strings (const void *vp1, const void *vp2);
131132

132133
/* virt-v2v version and features (read from remote). */
133134
extern char *v2v_version;

utils.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,3 +253,11 @@ wait_network_online (const struct config *config)
253253

254254
ignore_value (system (NETWORK_ONLINE_COMMAND));
255255
}
256+
257+
int
258+
compare_strings (const void *vp1, const void *vp2)
259+
{
260+
char * const *p1 = (char * const *) vp1;
261+
char * const *p2 = (char * const *) vp2;
262+
return strcmp (*p1, *p2);
263+
}

0 commit comments

Comments
 (0)