public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/rpm2targz:master commit in: /
Date: Thu, 17 May 2012 04:44:21 +0000 (UTC)	[thread overview]
Message-ID: <1337229846.a9f55f411d42fc5f60c099d7d9bc432f0be3852d.vapier@gentoo> (raw)

commit:     a9f55f411d42fc5f60c099d7d9bc432f0be3852d
Author:     Christoph Junghans <ottxor <AT> gentoo <DOT> org>
AuthorDate: Thu May 17 04:43:06 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu May 17 04:44:06 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/rpm2targz.git;a=commit;h=a9f55f41

rpmoffset: provide a local memmem for non-glibc systems

URL: https://bugs.gentoo.org/397835
Reported-by: Christoph Junghans <ottxor <AT> gentoo.org>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 rpmoffset.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/rpmoffset.c b/rpmoffset.c
index 0a3c488..628af93 100644
--- a/rpmoffset.c
+++ b/rpmoffset.c
@@ -19,6 +19,26 @@
 # define BUFSIZ 8192
 #endif
 
+#if !defined(__GLIBC__)
+static void *rp_memmem(const void *buf, size_t buflen, const void *pattern, size_t len)
+{
+	char *bf = (char *)buf, *pt = (char *)pattern, *p = bf;
+
+	while (len <= (buflen - (p - bf))) {
+		if (NULL != (p = memchr(p, (int)(*pt), buflen - (p - bf)))) {
+			if (0 == memcmp(p, pattern, len))
+				return p;
+			else
+				++p;
+		}
+		else
+			break;
+	}
+	return NULL;
+}
+#define memmem(a,b,c,d) rp_memmem(a,b,c,d)
+#endif
+
 typedef struct {
 	const char *type;
 	const unsigned char *magic;



             reply	other threads:[~2012-05-17  4:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-17  4:44 Mike Frysinger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-05-17  4:59 [gentoo-commits] proj/rpm2targz:master commit in: / Mike Frysinger
2012-05-17  4:59 Mike Frysinger
2021-03-16 23:33 Mike Frysinger
2021-03-16 23:33 Mike Frysinger
2021-03-16 23:33 Mike Frysinger
2021-03-16 23:33 Mike Frysinger
2021-03-16 23:33 Mike Frysinger
2021-03-16 23:33 Mike Frysinger
2021-03-16 23:33 Mike Frysinger
2021-03-16 23:33 Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1337229846.a9f55f411d42fc5f60c099d7d9bc432f0be3852d.vapier@gentoo \
    --to=vapier@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox