- wimlib_assert(blob->refcnt == inode->i_nlink);
-
- /* If the WIM of the template image is the same as the WIM of
- * the new image, then @template_blob can be used directly.
- *
- * Otherwise, look for a blob with the same hash in the WIM of
- * the new image. If found, use it; otherwise re-use the
- * blob descriptor being discarded, filling in the hash. */
-
- if (wim == template_wim)
- replace_blob = template_blob;
- else
- replace_blob = lookup_blob(wim->blob_table,
- template_blob->hash);
-
- list_del(&blob->unhashed_list);
- if (replace_blob) {
+ back_ptr = retrieve_pointer_to_unhashed_blob(blob);
+ copy_hash(blob->hash, template_blob->hash);
+ if (after_blob_hashed(blob, back_ptr, blob_table) != blob)