diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2013-07-07 11:07:06 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2013-07-07 11:16:55 -0400 |
commit | faa1ff8ef8d98fe148ac0efab15fcdf0cabdcaae (patch) | |
tree | 4f0816897494168e1d0bab25367fb5b6782aaaa4 /src/udev/udev-builtin-net_id.c | |
parent | 44e6f1bc1a3f11daf569d310de1707f3b423786a (diff) |
Import strxcpyx from upstream
This commit imports strxcpyx from upstream. This is upstream commit
d5a89d7dc17a5ba5cf4fc71f82963c5c94a31c3d
Note: there were also some very minor code cleanups to
accelerometer.c: line 187
collect.c: lines 35, 140
libudev-device.c: line 780
libudev-hwdb.c: line 300
These are part of upstream commits:
507f22bd0172bff5e5d98145b1419bd472a2c57f
3cf7b686e6b29f78de0af5929602cae4482f6d49
67410e9f73a6cdd8453c78b966451b5151def14a
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/udev/udev-builtin-net_id.c')
-rw-r--r-- | src/udev/udev-builtin-net_id.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c index 37ae710ea9..9c1c5feb0d 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -193,12 +193,12 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) { s = names->pci_path; l = sizeof(names->pci_path); if (domain > 0) - l = util_strpcpyf(&s, l, "P%d", domain); - l = util_strpcpyf(&s, l, "p%ds%d", bus, slot); + l = strpcpyf(&s, l, "P%d", domain); + l = strpcpyf(&s, l, "p%ds%d", bus, slot); if (func > 0 || is_pci_multifunction(names->pcidev)) - l = util_strpcpyf(&s, l, "f%d", func); + l = strpcpyf(&s, l, "f%d", func); if (dev_id > 0) - l = util_strpcpyf(&s, l, "d%d", dev_id); + l = strpcpyf(&s, l, "d%d", dev_id); if (l == 0) names->pci_path[0] = '\0'; @@ -230,7 +230,7 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) { snprintf(str, sizeof(str), "%s/%s/address", slots, dent->d_name); if (read_one_line_file(str, &address) >= 0) { /* match slot address with device by stripping the function */ - if (strncmp(address, udev_device_get_sysname(names->pcidev), strlen(address)) == 0) + if (strneq(address, udev_device_get_sysname(names->pcidev), strlen(address))) hotplug_slot = i; free(address); } @@ -244,12 +244,12 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) { s = names->pci_slot; l = sizeof(names->pci_slot); if (domain > 0) - l = util_strpcpyf(&s, l, "P%d", domain); - l = util_strpcpyf(&s, l, "s%d", hotplug_slot); + l = strpcpyf(&s, l, "P%d", domain); + l = strpcpyf(&s, l, "s%d", hotplug_slot); if (func > 0 || is_pci_multifunction(names->pcidev)) - l = util_strpcpyf(&s, l, "f%d", func); + l = strpcpyf(&s, l, "f%d", func); if (dev_id > 0) - l = util_strpcpyf(&s, l, "d%d", dev_id); + l = strpcpyf(&s, l, "d%d", dev_id); if (l == 0) names->pci_path[0] = '\0'; } @@ -292,7 +292,7 @@ static int names_usb(struct udev_device *dev, struct netnames *names) { return -ENOENT; /* get USB port number chain, configuration, interface */ - util_strscpy(name, sizeof(name), udev_device_get_sysname(usbdev)); + strscpy(name, sizeof(name), udev_device_get_sysname(usbdev)); s = strchr(name, '-'); if (!s) return -EINVAL; @@ -315,15 +315,15 @@ static int names_usb(struct udev_device *dev, struct netnames *names) { while ((s = strchr(s, '.'))) s[0] = 'u'; s = names->usb_ports; - l = util_strpcpyl(&s, sizeof(names->usb_ports), "u", ports, NULL); + l = strpcpyl(&s, sizeof(names->usb_ports), "u", ports, NULL); /* append USB config number, suppress the common config == 1 */ if (!streq(config, "1")) - l = util_strpcpyl(&s, sizeof(names->usb_ports), "c", config, NULL); + l = strpcpyl(&s, sizeof(names->usb_ports), "c", config, NULL); /* append USB interface number, suppress the interface == 0 */ if (!streq(interf, "0")) - l = util_strpcpyl(&s, sizeof(names->usb_ports), "i", interf, NULL); + l = strpcpyl(&s, sizeof(names->usb_ports), "i", interf, NULL); if (l == 0) return -ENAMETOOLONG; @@ -423,7 +423,7 @@ static int builtin_net_id(struct udev_device *dev, int argc, char *argv[], bool p = udev_device_get_sysattr_value(dev, "iflink"); if (!p) return EXIT_FAILURE; - if (strcmp(s, p) != 0) + if (!streq(s, p)) return 0; devtype = udev_device_get_devtype(dev); |