-static int
-add_stream(struct wim_inode *inode, struct generation_context *ctx,
- int stream_type, const utf16lechar *stream_name,
- void *buffer, size_t size)
-{
- struct blob_descriptor *blob = NULL;
- struct wim_inode_stream *strm;
-
- if (size) {
- blob = new_blob_descriptor();
- if (!blob)
- goto err_nomem;
- blob->attached_buffer = buffer;
- blob->blob_location = BLOB_IN_ATTACHED_BUFFER;
- blob->size = size;
- }
-
- strm = inode_add_stream(inode, stream_type, stream_name, blob);
- if (unlikely(!strm))
- goto err_nomem;
-
- prepare_unhashed_blob(blob, inode, strm->stream_id,
- ctx->params->unhashed_blobs);
- return 0;
-
-err_nomem:
- free_blob_descriptor(blob);
- return WIMLIB_ERR_NOMEM;
-}
-