File: strchr.c

package info (click to toggle)
dietlibc 0.34~cvs20160606-12
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 11,388 kB
  • sloc: ansic: 71,664; asm: 13,008; cpp: 1,860; makefile: 804; sh: 292; perl: 62
file content (27 lines) | stat: -rw-r--r-- 647 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "dietfeatures.h"
#include <string.h>

char *strchr(register const char *t, int c) {
  register char ch;

  ch = c;
  for (;;) {
    if (__unlikely(*t == ch)) break;
				     if (__unlikely(!*t)) return 0;
								    ++t;
#ifndef WANT_SMALL_STRING_ROUTINES
    if (__unlikely(*t == ch)) break;
				     if (__unlikely(!*t)) return 0;
								    ++t;
    if (__unlikely(*t == ch)) break;
				     if (__unlikely(!*t)) return 0;
								    ++t;
    if (__unlikely(*t == ch)) break;
				     if (__unlikely(!*t)) return 0;
								    ++t;
#endif
  }
  return (char*)t;
}

char *index(char *t,int c)	__attribute__((weak,alias("strchr")));