public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Ulf Hermann <ulf.hermann@qt.io>
To: <elfutils-devel@sourceware.org>
Subject: [PATCH] Define roundup() for strings.c if it doesn't exist
Date: Thu, 04 May 2017 09:57:00 -0000	[thread overview]
Message-ID: <7e561493-0a3b-b7f7-5145-b5666eeffb51@qt.io> (raw)

Change-Id: I6ea7c1f894e89bbaaecb724473c4c00e67296f05
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
---
 src/ChangeLog | 4 ++++
 src/strings.c | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/src/ChangeLog b/src/ChangeLog
index 64db1ca..4a32604 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2017-05-04  Ulf Hermann  <ulf.hermann@qt.io>
+
+	* strings.c: If roundup() is not defined, define it.
+
 2017-04-28  Ulf Hermann  <ulf.hermann@qt.io>
 
 	* Makefile.am: Use the predefined names for libelf, libdw, libasm,
diff --git a/src/strings.c b/src/strings.c
index d214356..22cbfac 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -450,6 +450,9 @@ process_chunk (const char *fname, const unsigned char *buf, off_t to,
     *unprinted = xstrndup ((const char *) start, curlen);
 }
 
+#ifndef roundup
+#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
+#endif
 
 /* Map a file in as large chunks as possible.  */
 static void *
-- 
2.1.4

                 reply	other threads:[~2017-05-04  9:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=7e561493-0a3b-b7f7-5145-b5666eeffb51@qt.io \
    --to=ulf.hermann@qt.io \
    --cc=elfutils-devel@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).