mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-18 08:47:00 +00:00
(un)likely: use __builtin_expect to inform expected path
Remove also unnecessary comparison in getdata nth_field(). Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
6f179db03d
commit
acba2e265e
4 changed files with 25 additions and 3 deletions
|
|
@ -175,7 +175,7 @@ void nth_field(char *restrict dest, const char *restrict src)
|
|||
len = strlen(src);
|
||||
for (i = 0; i < len; i++) {
|
||||
dest[i] = src[i];
|
||||
if (src[i] == ' ' || dest[i] == '\0') {
|
||||
if (unlikely(src[i] == ' ')) {
|
||||
dest[i] = '\0';
|
||||
break;
|
||||
}
|
||||
|
|
@ -233,7 +233,7 @@ void parse_config(int is_include, const char *restrict config_file,
|
|||
#endif /* POSIX_FADV_SEQUENTIAL */
|
||||
|
||||
/* Very hairy stuff begins. */
|
||||
while (!feof(dhcpd_config)) {
|
||||
while (unlikely(!feof(dhcpd_config))) {
|
||||
c = fgetc(dhcpd_config);
|
||||
/* Certain characters are magical */
|
||||
switch (c) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue