void const *data, // IN
size_t size); // IN
-Bool
+MUST_CHECK_RETURN Bool
DynBuf_Insert(DynBuf *b, // IN/OUT
size_t offset, // IN
void const *data, // IN
#define DynBuf_SafeAppend(_buf, _data, _size) \
DynBuf_SafeInternalAppend(_buf, _data, _size, __FILE__, __LINE__)
+void
+DynBuf_SafeInternalInsert(DynBuf *b, // IN/OUT
+ size_t offset, // IN
+ void const *data, // IN
+ size_t size, // IN
+ char const *file, // IN
+ unsigned int lineno); // IN
+
+#define DynBuf_SafeInsert(_buf, _offset, _data, _size) \
+ DynBuf_SafeInternalInsert(_buf, _offset, _data, _size, __FILE__, __LINE__)
+
void
DynBuf_SafeInternalEnlarge(DynBuf *b, // IN/OUT
size_t min_size, // IN
}
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * DynBuf_SafeInternalInsert --
+ *
+ * Insert data at a given offset within a dynamic buffer. Memory
+ * allocation failure is handled the same way as Util_SafeMalloc, that is
+ * to say, with a Panic.
+ *
+ * Results:
+ * None
+ *
+ * Side effects:
+ * None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+void
+DynBuf_SafeInternalInsert(DynBuf *b, // IN/OUT:
+ size_t offset, // IN:
+ void const *data, // IN:
+ size_t size, // IN:
+ char const *file, // IN:
+ unsigned int lineno) // IN:
+{
+ if (!DynBuf_Insert(b, offset, data, size)) {
+ Panic("Unrecoverable memory allocation failure at %s:%u\n",
+ file, lineno);
+ }
+}
+
+
/*
*-----------------------------------------------------------------------------
*
* DynBuf_SafeInternalAppend --
*
* Append data at the end of a dynamic buffer. Memory allocation failure
- * are handled the same way as Util_SafeMalloc, that is to say, with a
+ * is handled the same way as Util_SafeMalloc, that is to say, with a
* Panic.
*
* Results: