summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgraham.gower@gmail.com <graham.gower@gmail.com@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2010-11-18 22:55:38 (EST)
committer graham.gower@gmail.com <graham.gower@gmail.com@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2010-11-18 22:55:38 (EST)
commit6ee4d7075a8d19f1b465bd2d222a182c1d8345e7 (patch)
treed0c56671c6997ec8f7b25d4d3cfba99ecd7a0ee9
parentdcb875bea220d4eddd6b398046e91d3781083fe6 (diff)
Fix indentation.
git-svn-id: http://opkg.googlecode.com/svn/trunk@580 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
-rw-r--r--libopkg/sprintf_alloc.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/libopkg/sprintf_alloc.c b/libopkg/sprintf_alloc.c
index 03a5f27..08c56bf 100644
--- a/libopkg/sprintf_alloc.c
+++ b/libopkg/sprintf_alloc.c
@@ -22,44 +22,44 @@
int sprintf_alloc(char **str, const char *fmt, ...)
{
- va_list ap;
- int n;
- unsigned size = 100;
+ va_list ap;
+ int n;
+ unsigned size = 100;
- if (!str) {
- opkg_msg(ERROR, "Internal error: str=NULL.\n");
- return -1;
- }
- if (!fmt) {
- opkg_msg(ERROR, "Internal error: fmt=NULL.\n");
- return -1;
- }
+ if (!str) {
+ opkg_msg(ERROR, "Internal error: str=NULL.\n");
+ return -1;
+ }
+ if (!fmt) {
+ opkg_msg(ERROR, "Internal error: fmt=NULL.\n");
+ return -1;
+ }
- /* On x86_64 systems, any strings over 100 were segfaulting.
- It seems that the ap needs to be reinitalized before every
- use of the v*printf() functions. I pulled the functionality out
- of vsprintf_alloc and combined it all here instead.
- */
+ /* On x86_64 systems, any strings over 100 were segfaulting.
+ It seems that the ap needs to be reinitalized before every
+ use of the v*printf() functions. I pulled the functionality out
+ of vsprintf_alloc and combined it all here instead.
+ */
- /* ripped more or less straight out of PRINTF(3) */
+ /* ripped more or less straight out of PRINTF(3) */
- *str = xcalloc(1, size);
+ *str = xcalloc(1, size);
- while(1) {
- va_start(ap, fmt);
- n = vsnprintf (*str, size, fmt, ap);
- va_end(ap);
- /* If that worked, return the size. */
- if (n > -1 && n < size)
- return n;
- /* Else try again with more space. */
- if (n > -1) /* glibc 2.1 */
- size = n+1; /* precisely what is needed */
- else /* glibc 2.0 */
- size *= 2; /* twice the old size */
- *str = xrealloc(*str, size);
- }
+ while (1) {
+ va_start(ap, fmt);
+ n = vsnprintf (*str, size, fmt, ap);
+ va_end(ap);
+ /* If that worked, return the size. */
+ if (n > -1 && n < size)
+ return n;
+ /* Else try again with more space. */
+ if (n > -1) /* glibc 2.1 */
+ size = n+1; /* precisely what is needed */
+ else /* glibc 2.0 */
+ size *= 2; /* twice the old size */
+ *str = xrealloc(*str, size);
+ }
- return -1; /* Just to be correct - it probably won't get here */
+ return -1; /* Just to be correct - it probably won't get here */
}