squid-
cache.org
Optimising Web Delivery
Docs
Download
Donate
Support
About
Contact
Shop
Blog
compat
memrchr.cc
Go to the documentation of this file.
1
/*
2
* Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3
*
4
* Squid software is distributed under GPLv2+ license and includes
5
* contributions from numerous individuals and organizations.
6
* Please see the COPYING and CONTRIBUTORS files for details.
7
*/
8
9
/*
10
* Copyright (c) 2007 Todd C. Miller <Todd.Miller@courtesan.com>
11
*
12
* Permission to use, copy, modify, and distribute this software for any
13
* purpose with or without fee is hereby granted, provided that the above
14
* copyright notice and this permission notice appear in all copies.
15
*
16
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
17
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
18
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
19
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
21
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
22
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23
*/
24
25
#include "
squid.h
"
26
27
#if !HAVE_MEMRCHR
28
29
#include "
compat/memrchr.h
"
30
31
/*
32
* Reverse memchr()
33
* Find the last occurrence of 'c' in the buffer 's' of size 'n'.
34
*/
35
void
*
36
memrchr
(
const
void
*s,
int
c,
size_t
n)
37
{
38
const
unsigned
char
*cp;
39
40
if
(n != 0) {
41
cp = (
unsigned
char
*)s + n;
42
do
{
43
if
(*(--cp) == (
unsigned
char)c)
44
return
((
void
*)cp);
45
}
while
(--n != 0);
46
}
47
return
((
void
*)0);
48
}
49
50
#endif
51
memrchr
void * memrchr(const void *s, int c, size_t n)
Definition:
memrchr.cc:36
memrchr.h
squid.h
Introduction
About Squid
Why Squid?
Squid Developers
How to Donate
How to Help Out
Getting Squid
Squid Source Packages
Squid Deployment Case-Studies
Squid Software Foundation
Documentation
Quick Setup
Configuration:
Reference
Examples
FAQ
and
Wiki
Guide Books:
Beginners
Definitive
Non-English
More...
Support
Security Advisories
Bugzilla Database
Mailing lists
Contacting us
Commercial services
Project Sponsors
Squid-based products
Miscellaneous
Developer Resources
Related Writings
Related Software:
Authenticators
Ecap
Icap
Ident
Log Analysis
Monitor
Proxies
Redirectors
General
Squid Artwork
Web Site Translations
Japanese
Mirrors
Website:
...
full list
FTP Package Archive