- util_strlcpy(serial, vendor_str, sizeof(serial));
- util_strlcat(serial, "_", sizeof(serial));
- util_strlcat(serial, model_str, sizeof(serial));
- if (serial_str[0] != '\0') {
- util_strlcat(serial, "_", sizeof(serial));
- util_strlcat(serial, serial_str, sizeof(serial));
- }
- if (instance_str[0] != '\0') {
- util_strlcat(serial, "-", sizeof(serial));
- util_strlcat(serial, instance_str, sizeof(serial));
- }
+ s = serial;
+ l = util_strpcpyl(&s, sizeof(serial), vendor_str, "_", model_str, NULL);
+ if (serial_str[0] != '\0')
+ l = util_strpcpyl(&s, l, "_", serial_str, NULL);
+ if (instance_str[0] != '\0')
+ util_strpcpyl(&s, l, "-", instance_str, NULL);