mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 4/7] move simple_itoa to libbb so that others can use it
Date: Mon, 11 Apr 2011 16:18:38 +0200	[thread overview]
Message-ID: <1302531521-7439-5-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1302531521-7439-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/hush.c   |   15 +--------------
 include/libbb.h |    2 ++
 lib/libbb.c     |   13 +++++++++++++
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/common/hush.c b/common/hush.c
index 77610bb..573bd3e 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -121,6 +121,7 @@
 #include <libbb.h>
 #include <glob.h>
 #include <getopt.h>
+#include <libbb.h>
 #include <linux/list.h>
 
 /*cmd_boot.c*/
@@ -361,20 +362,6 @@ static int b_addqchr(o_string *o, int ch, int quote)
 	return b_addchr(o, ch);
 }
 
-/* belongs in utility.c */
-static char *simple_itoa(unsigned int i)
-{
-	/* 21 digits plus null terminator, good for 64-bit or smaller ints */
-	static char local[22];
-	char *p = &local[21];
-	*p-- = '\0';
-	do {
-		*p-- = '0' + i % 10;
-		i /= 10;
-	} while (i > 0);
-	return p + 1;
-}
-
 static int b_adduint(o_string *o, unsigned int i)
 {
 	int r;
diff --git a/include/libbb.h b/include/libbb.h
index 4151230..0962969 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -30,4 +30,6 @@ int copy_file(const char *src, const char *dst);
 
 int process_escape_sequence(const char *source, char *dest, int destlen);
 
+char *simple_itoa(unsigned int i);
+
 #endif /* __LIBBB_H */
diff --git a/lib/libbb.c b/lib/libbb.c
index 4d532f6..3d02202 100644
--- a/lib/libbb.c
+++ b/lib/libbb.c
@@ -114,3 +114,16 @@ char * safe_strncpy(char *dst, const char *src, size_t size)
 }
 EXPORT_SYMBOL(safe_strncpy);
 
+char *simple_itoa(unsigned int i)
+{
+	/* 21 digits plus null terminator, good for 64-bit or smaller ints */
+	static char local[22];
+	char *p = &local[21];
+	*p-- = '\0';
+	do {
+		*p-- = '0' + i % 10;
+		i /= 10;
+	} while (i > 0);
+	return p + 1;
+}
+EXPORT_SYMBOL(simple_itoa);
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2011-04-11 14:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-11 14:18 assorted patches Sascha Hauer
2011-04-11 14:18 ` [PATCH 1/7] eth: check the result of edev->get_ethaddr Sascha Hauer
2011-04-11 14:18 ` [PATCH 2/7] net: add a context to the packet handler Sascha Hauer
2011-04-11 14:18 ` [PATCH 3/7] environment: make default env path configurable Sascha Hauer
2011-04-11 14:18 ` Sascha Hauer [this message]
2011-04-11 14:18 ` [PATCH 5/7] kfifo: kfifo_put takes a const buffer Sascha Hauer
2011-04-11 14:18 ` [PATCH 6/7] copy_file: handle write return value correctly Sascha Hauer
2011-04-11 14:18 ` [PATCH 7/7] cp command: handle directories as last argument Sascha Hauer

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=1302531521-7439-5-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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