aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/ralloc.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-10-27 08:37:52 +0200
committermarha <marha@users.sourceforge.net>2011-10-27 08:37:52 +0200
commit2a9be4af293f20fa33cc34fbc3b72e2235d91090 (patch)
treed41608bda1d56be1aa96857dee20e988b53760a3 /mesalib/src/glsl/ralloc.h
parent9d53da0fbb9ae6df9a38ad40df4f53cd28287235 (diff)
parentd662d461634660f5c0f3998b5eb7d7ed3bd5a25f (diff)
downloadvcxsrv-2a9be4af293f20fa33cc34fbc3b72e2235d91090.tar.gz
vcxsrv-2a9be4af293f20fa33cc34fbc3b72e2235d91090.tar.bz2
vcxsrv-2a9be4af293f20fa33cc34fbc3b72e2235d91090.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/glsl/ralloc.h')
-rw-r--r--mesalib/src/glsl/ralloc.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/mesalib/src/glsl/ralloc.h b/mesalib/src/glsl/ralloc.h
index d5338152f..1324f3466 100644
--- a/mesalib/src/glsl/ralloc.h
+++ b/mesalib/src/glsl/ralloc.h
@@ -314,9 +314,60 @@ char *ralloc_asprintf (const void *ctx, const char *fmt, ...);
char *ralloc_vasprintf(const void *ctx, const char *fmt, va_list args);
/**
+ * Rewrite the tail of an existing string, starting at a given index.
+ *
+ * Overwrites the contents of *str starting at \p start with newly formatted
+ * text, including a new null-terminator. Allocates more memory as necessary.
+ *
+ * This can be used to append formatted text when the length of the existing
+ * string is already known, saving a strlen() call.
+ *
+ * \sa ralloc_asprintf_append
+ *
+ * \param str The string to be updated.
+ * \param start The index to start appending new data at.
+ * \param fmt A printf-style formatting string
+ *
+ * \p str will be updated to the new pointer unless allocation fails.
+ *
+ * \return True unless allocation failed.
+ */
+bool ralloc_asprintf_rewrite_tail(char **str, size_t start,
+ const char *fmt, ...);
+
+/**
+ * Rewrite the tail of an existing string, starting at a given index.
+ *
+ * Overwrites the contents of *str starting at \p start with newly formatted
+ * text, including a new null-terminator. Allocates more memory as necessary.
+ *
+ * This can be used to append formatted text when the length of the existing
+ * string is already known, saving a strlen() call.
+ *
+ * \sa ralloc_vasprintf_append
+ *
+ * \param str The string to be updated.
+ * \param start The index to start appending new data at.
+ * \param fmt A printf-style formatting string
+ * \param args A va_list containing the data to be formatted
+ *
+ * \p str will be updated to the new pointer unless allocation fails.
+ *
+ * \return True unless allocation failed.
+ */
+bool ralloc_vasprintf_rewrite_tail(char **str, size_t start, const char *fmt,
+ va_list args);
+
+/**
* Append formatted text to the supplied string.
*
+ * This is equivalent to
+ * \code
+ * ralloc_asprintf_rewrite_tail(str, strlen(*str), fmt, ...)
+ * \endcode
+ *
* \sa ralloc_asprintf
+ * \sa ralloc_asprintf_rewrite_tail
* \sa ralloc_strcat
*
* \p str will be updated to the new pointer unless allocation fails.
@@ -328,7 +379,13 @@ bool ralloc_asprintf_append (char **str, const char *fmt, ...);
/**
* Append formatted text to the supplied string, given a va_list.
*
+ * This is equivalent to
+ * \code
+ * ralloc_vasprintf_rewrite_tail(str, strlen(*str), fmt, args)
+ * \endcode
+ *
* \sa ralloc_vasprintf
+ * \sa ralloc_vasprintf_rewrite_tail
* \sa ralloc_strcat
*
* \p str will be updated to the new pointer unless allocation fails.