index.c (116189) | index.c (127586) |
---|---|
1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/libkern/index.c 116189 2003-06-11 05:37:42Z obrien $"); | 35__FBSDID("$FreeBSD: head/sys/libkern/index.c 127586 2004-03-29 21:15:41Z robert $"); |
36 37#include <sys/param.h> 38#include <sys/libkern.h> 39 40char * 41index(p, ch) 42 const char *p; 43 int ch; 44{ 45 union { 46 const char *cp; 47 char *p; 48 } u; 49 50 u.cp = p; 51 for (;; ++u.p) { 52 if (*u.p == ch) 53 return(u.p); | 36 37#include <sys/param.h> 38#include <sys/libkern.h> 39 40char * 41index(p, ch) 42 const char *p; 43 int ch; 44{ 45 union { 46 const char *cp; 47 char *p; 48 } u; 49 50 u.cp = p; 51 for (;; ++u.p) { 52 if (*u.p == ch) 53 return(u.p); |
54 if (!*u.p) | 54 if (*u.p == '\0') |
55 return(NULL); 56 } 57 /* NOTREACHED */ 58} | 55 return(NULL); 56 } 57 /* NOTREACHED */ 58} |