Coverage Report

Created: 2025-07-11 07:04

/src/nspr/lib/libc/src/strpbrk.c
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
 * License, v. 2.0. If a copy of the MPL was not distributed with this
4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#include "plstr.h"
7
#include <string.h>
8
9
PR_IMPLEMENT(char*)
10
0
PL_strpbrk(const char* s, const char* list) {
11
0
  if (((const char*)0 == s) || ((const char*)0 == list)) {
12
0
    return (char*)0;
13
0
  }
14
15
0
  return strpbrk(s, list);
16
0
}
17
18
PR_IMPLEMENT(char*)
19
0
PL_strprbrk(const char* s, const char* list) {
20
0
  const char* p;
21
0
  const char* r;
22
23
0
  if (((const char*)0 == s) || ((const char*)0 == list)) {
24
0
    return (char*)0;
25
0
  }
26
27
0
  for (r = s; *r; r++);
28
29
0
  for (r--; r >= s; r--)
30
0
    for (p = list; *p; p++)
31
0
      if (*r == *p) {
32
0
        return (char*)r;
33
0
      }
34
35
0
  return (char*)0;
36
0
}
37
38
PR_IMPLEMENT(char*)
39
0
PL_strnpbrk(const char* s, const char* list, PRUint32 max) {
40
0
  const char* p;
41
42
0
  if (((const char*)0 == s) || ((const char*)0 == list)) {
43
0
    return (char*)0;
44
0
  }
45
46
0
  for (; max && *s; s++, max--)
47
0
    for (p = list; *p; p++)
48
0
      if (*s == *p) {
49
0
        return (char*)s;
50
0
      }
51
52
0
  return (char*)0;
53
0
}
54
55
PR_IMPLEMENT(char*)
56
0
PL_strnprbrk(const char* s, const char* list, PRUint32 max) {
57
0
  const char* p;
58
0
  const char* r;
59
60
0
  if (((const char*)0 == s) || ((const char*)0 == list)) {
61
0
    return (char*)0;
62
0
  }
63
64
0
  for (r = s; max && *r; r++, max--);
65
66
0
  for (r--; r >= s; r--)
67
0
    for (p = list; *p; p++)
68
0
      if (*r == *p) {
69
0
        return (char*)r;
70
0
      }
71
72
0
  return (char*)0;
73
0
}