We have strcasecmp() in libkern now.
This commit is contained in:
parent
04fa63f05e
commit
4d00f78b40
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=168421
@ -323,8 +323,7 @@ ndis_create_sysctls(arg)
|
|||||||
TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) {
|
TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) {
|
||||||
#endif
|
#endif
|
||||||
oidp = e->entry;
|
oidp = e->entry;
|
||||||
if (ndis_strcasecmp(oidp->oid_name,
|
if (strcasecmp(oidp->oid_name, vals->nc_cfgkey) == 0)
|
||||||
vals->nc_cfgkey) == 0)
|
|
||||||
break;
|
break;
|
||||||
oidp = NULL;
|
oidp = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1746,8 +1746,6 @@ extern int ndis_destroy_dma(void *);
|
|||||||
extern int ndis_create_sysctls(void *);
|
extern int ndis_create_sysctls(void *);
|
||||||
extern int ndis_add_sysctl(void *, char *, char *, char *, int);
|
extern int ndis_add_sysctl(void *, char *, char *, char *, int);
|
||||||
extern int ndis_flush_sysctls(void *);
|
extern int ndis_flush_sysctls(void *);
|
||||||
extern int ndis_strcasecmp(const char *, const char *);
|
|
||||||
extern int ndis_strncasecmp(const char *, const char *, size_t);
|
|
||||||
|
|
||||||
extern uint32_t NdisAddDevice(driver_object *, device_object *);
|
extern uint32_t NdisAddDevice(driver_object *, device_object *);
|
||||||
extern void NdisAllocatePacketPool(ndis_status *,
|
extern void NdisAllocatePacketPool(ndis_status *,
|
||||||
|
@ -613,53 +613,6 @@ ndis_encode_parm(block, oid, type, parm)
|
|||||||
return(NDIS_STATUS_SUCCESS);
|
return(NDIS_STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
ndis_strcasecmp(s1, s2)
|
|
||||||
const char *s1;
|
|
||||||
const char *s2;
|
|
||||||
{
|
|
||||||
char a, b;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* In the kernel, toupper() is a macro. Have to be careful
|
|
||||||
* not to use pointer arithmetic when passing it arguments.
|
|
||||||
*/
|
|
||||||
|
|
||||||
while(1) {
|
|
||||||
a = *s1;
|
|
||||||
b = *s2++;
|
|
||||||
if (toupper(a) != toupper(b))
|
|
||||||
break;
|
|
||||||
if (*s1++ == '\0')
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
ndis_strncasecmp(s1, s2, n)
|
|
||||||
const char *s1;
|
|
||||||
const char *s2;
|
|
||||||
size_t n;
|
|
||||||
{
|
|
||||||
char a, b;
|
|
||||||
|
|
||||||
if (n != 0) {
|
|
||||||
do {
|
|
||||||
a = *s1;
|
|
||||||
b = *s2++;
|
|
||||||
if (toupper(a) != toupper(b))
|
|
||||||
return (*(const unsigned char *)s1 -
|
|
||||||
*(const unsigned char *)(s2 - 1));
|
|
||||||
if (*s1++ == '\0')
|
|
||||||
break;
|
|
||||||
} while (--n != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
NdisReadConfiguration(status, parm, cfg, key, type)
|
NdisReadConfiguration(status, parm, cfg, key, type)
|
||||||
ndis_status *status;
|
ndis_status *status;
|
||||||
@ -700,7 +653,7 @@ NdisReadConfiguration(status, parm, cfg, key, type)
|
|||||||
TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) {
|
TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) {
|
||||||
#endif
|
#endif
|
||||||
oidp = e->entry;
|
oidp = e->entry;
|
||||||
if (ndis_strcasecmp(oidp->oid_name, keystr) == 0) {
|
if (strcasecmp(oidp->oid_name, keystr) == 0) {
|
||||||
if (strcmp((char *)oidp->oid_arg1, "UNSET") == 0) {
|
if (strcmp((char *)oidp->oid_arg1, "UNSET") == 0) {
|
||||||
RtlFreeAnsiString(&as);
|
RtlFreeAnsiString(&as);
|
||||||
*status = NDIS_STATUS_FAILURE;
|
*status = NDIS_STATUS_FAILURE;
|
||||||
@ -809,7 +762,7 @@ NdisWriteConfiguration(status, cfg, key, parm)
|
|||||||
TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) {
|
TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) {
|
||||||
#endif
|
#endif
|
||||||
oidp = e->entry;
|
oidp = e->entry;
|
||||||
if (ndis_strcasecmp(oidp->oid_name, keystr) == 0) {
|
if (strcasecmp(oidp->oid_name, keystr) == 0) {
|
||||||
/* Found it, set the value. */
|
/* Found it, set the value. */
|
||||||
strcpy((char *)oidp->oid_arg1, val);
|
strcpy((char *)oidp->oid_arg1, val);
|
||||||
RtlFreeAnsiString(&as);
|
RtlFreeAnsiString(&as);
|
||||||
|
@ -53,8 +53,6 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/errno.h>
|
#include <sys/errno.h>
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
extern int ndis_strncasecmp(const char *, const char *, size_t);
|
|
||||||
#define strncasecmp(a, b, c) ndis_strncasecmp(a, b, c)
|
|
||||||
#else
|
#else
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user