mirror of
https://github.com/systemd/systemd.git
synced 2025-01-27 10:54:11 +08:00
sd-bus: add define for the maximum name length
Less magic numbers in the code…
This commit is contained in:
parent
cfcc0059bf
commit
fb270a26b2
@ -97,7 +97,7 @@ bool interface_name_is_valid(const char *p) {
|
||||
dot = false;
|
||||
}
|
||||
|
||||
if (q - p > 255)
|
||||
if (q - p > SD_BUS_MAXIMUM_NAME_LENGTH)
|
||||
return false;
|
||||
|
||||
if (dot)
|
||||
@ -139,7 +139,7 @@ bool service_name_is_valid(const char *p) {
|
||||
dot = false;
|
||||
}
|
||||
|
||||
if (q - p > 255)
|
||||
if (q - p > SD_BUS_MAXIMUM_NAME_LENGTH)
|
||||
return false;
|
||||
|
||||
if (dot)
|
||||
@ -170,7 +170,7 @@ bool member_name_is_valid(const char *p) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (q - p > 255)
|
||||
if (q - p > SD_BUS_MAXIMUM_NAME_LENGTH)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -36,6 +36,9 @@ _SD_BEGIN_DECLARATIONS;
|
||||
/* https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-marshaling-signature */
|
||||
#define SD_BUS_MAXIMUM_SIGNATURE_LENGTH 255
|
||||
|
||||
/* https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names */
|
||||
#define SD_BUS_MAXIMUM_NAME_LENGTH 255
|
||||
|
||||
/* Types */
|
||||
|
||||
typedef struct sd_bus sd_bus;
|
||||
|
Loading…
Reference in New Issue
Block a user