Mercurial > illumos > illumos-gate
changeset 164:18337b53eb15
6276504 i_ddi_prop_search() may want to short-circuit calls to strcmp() when possible
author | cth |
---|---|
date | Wed, 13 Jul 2005 20:34:36 -0700 |
parents | 16f9603d607e |
children | a09828a8566b |
files | usr/src/uts/common/os/sunddi.c usr/src/uts/common/sys/sunddi.h |
diffstat | 2 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/os/sunddi.c Wed Jul 13 17:40:19 2005 -0700 +++ b/usr/src/uts/common/os/sunddi.c Wed Jul 13 20:34:36 2005 -0700 @@ -1467,7 +1467,7 @@ for (propp = *list_head; propp != NULL; propp = propp->prop_next) { - if (strcmp(propp->prop_name, name) != 0) + if (!DDI_STRSAME(propp->prop_name, name)) continue; if ((dev != DDI_DEV_T_ANY) && (propp->prop_dev != dev)) @@ -1514,7 +1514,7 @@ propp != NULL; propp = (ddi_prop_t *)propp->prop_next) { - if (strcmp(propp->prop_name, name) != 0) + if (!DDI_STRSAME(propp->prop_name, name)) continue; if ((!(flags & LDI_DEV_T_ANY)) && (propp->prop_dev != dev)) @@ -3672,7 +3672,7 @@ propp = DEVI(dip)->devi_hw_prop_ptr; while (propp != NULL) { - if (strcmp(name, propp->prop_name) == 0 && + if (DDI_STRSAME(propp->prop_name, name) && dev == propp->prop_dev) { /* @@ -4385,7 +4385,7 @@ mutex_enter(&(DEVI(dip)->devi_lock)); for (propp = *list_head; propp != NULL; propp = propp->prop_next) { - if ((strcmp(name, propp->prop_name) == 0) && + if (DDI_STRSAME(propp->prop_name, name) && (dev == propp->prop_dev)) { /* * Unlink this propp allowing for it to
--- a/usr/src/uts/common/sys/sunddi.h Wed Jul 13 17:40:19 2005 -0700 +++ b/usr/src/uts/common/sys/sunddi.h Wed Jul 13 20:34:36 2005 -0700 @@ -375,6 +375,7 @@ #else extern char *strchr(const char *, int); #endif /* __cplusplus >= 199711L */ +#define DDI_STRSAME(s1, s2) ((*(s1) == *(s2)) && (strcmp((s1), (s2)) == 0)) extern int strcmp(const char *, const char *) __PURE; extern int strncmp(const char *, const char *, size_t) __PURE; extern char *strncat(char *, const char *, size_t);