summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2011-09-14 02:03:49 +0200
committerGravatar Martin Szulecki2012-03-19 01:43:08 +0100
commit2c1eefbba3cc746ad593210097e64854a0f97464 (patch)
tree16857d9020208c9af56a86b01da5a239ec469835 /include
parent0df63036c888220ea2d5c122f3c19861b0959167 (diff)
downloadlibimobiledevice-2c1eefbba3cc746ad593210097e64854a0f97464.tar.gz
libimobiledevice-2c1eefbba3cc746ad593210097e64854a0f97464.tar.bz2
Moved asprintf.h to better location and include it in ideviceimagemounter.c
Diffstat (limited to 'include')
-rw-r--r--include/asprintf.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/asprintf.h b/include/asprintf.h
new file mode 100644
index 0000000..3b0072e
--- /dev/null
+++ b/include/asprintf.h
@@ -0,0 +1,33 @@
+#ifndef ASPRINTF_H
+#define ASPRINTF_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifndef HAVE_VASPRINTF
+static inline int vasprintf(char **PTR, const char *TEMPLATE, va_list AP)
+{
+ int res;
+ res = vsnprintf(NULL, 32768, TEMPLATE, AP);
+ if (res > 0) {
+ *PTR = (char*)malloc(res+1);
+ res = vsnprintf(*PTR, res, TEMPLATE, AP);
+ }
+ return res;
+}
+#endif
+
+#ifndef HAVE_ASPRINTF
+static inline int asprintf(char **PTR, const char *TEMPLATE, ...)
+{
+ int res;
+ va_list AP;
+ va_start(AP, TEMPLATE);
+ res = vasprintf(PTR, TEMPLATE, AP);
+ va_end(AP);
+ return res;
+}
+#endif
+
+#endif /* ASPRINTF_H */