No need to keep blob in sanitize context
This commit is contained in:
parent
254933c397
commit
8dfdca599c
|
@ -168,14 +168,12 @@ struct _hb_sanitize_context_t
|
||||||
const char *start, *end;
|
const char *start, *end;
|
||||||
hb_bool_t writable;
|
hb_bool_t writable;
|
||||||
unsigned int edit_count;
|
unsigned int edit_count;
|
||||||
hb_blob_t *blob;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static HB_GNUC_UNUSED void
|
static HB_GNUC_UNUSED void
|
||||||
_hb_sanitize_init (hb_sanitize_context_t *context,
|
_hb_sanitize_init (hb_sanitize_context_t *context,
|
||||||
hb_blob_t *blob)
|
hb_blob_t *blob)
|
||||||
{
|
{
|
||||||
context->blob = blob;
|
|
||||||
context->start = hb_blob_lock (blob);
|
context->start = hb_blob_lock (blob);
|
||||||
context->end = context->start + hb_blob_get_length (blob);
|
context->end = context->start + hb_blob_get_length (blob);
|
||||||
context->writable = hb_blob_is_writable (blob);
|
context->writable = hb_blob_is_writable (blob);
|
||||||
|
@ -189,15 +187,14 @@ _hb_sanitize_init (hb_sanitize_context_t *context,
|
||||||
|
|
||||||
static HB_GNUC_UNUSED void
|
static HB_GNUC_UNUSED void
|
||||||
_hb_sanitize_fini (hb_sanitize_context_t *context,
|
_hb_sanitize_fini (hb_sanitize_context_t *context,
|
||||||
bool unlock)
|
hb_blob_t *blob)
|
||||||
{
|
{
|
||||||
#if HB_DEBUG_SANITIZE
|
#if HB_DEBUG_SANITIZE
|
||||||
fprintf (stderr, "sanitize %p fini [%p..%p] %u edit requests\n",
|
fprintf (stderr, "sanitize %p fini [%p..%p] %u edit requests\n",
|
||||||
context->blob, context->start, context->end, context->edit_count);
|
blob, context->start, context->end, context->edit_count);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (unlock)
|
hb_blob_unlock (blob);
|
||||||
hb_blob_unlock (context->blob);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HB_GNUC_UNUSED inline bool
|
static HB_GNUC_UNUSED inline bool
|
||||||
|
@ -323,10 +320,10 @@ struct Sanitizer
|
||||||
sane = false;
|
sane = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_hb_sanitize_fini (&context, true);
|
_hb_sanitize_fini (&context, blob);
|
||||||
} else {
|
} else {
|
||||||
unsigned int edit_count = context.edit_count;
|
unsigned int edit_count = context.edit_count;
|
||||||
_hb_sanitize_fini (&context, true);
|
_hb_sanitize_fini (&context, blob);
|
||||||
if (edit_count && !hb_blob_is_writable (blob) && hb_blob_try_writable (blob)) {
|
if (edit_count && !hb_blob_is_writable (blob) && hb_blob_try_writable (blob)) {
|
||||||
/* ok, we made it writable by relocating. try again */
|
/* ok, we made it writable by relocating. try again */
|
||||||
#if HB_DEBUG_SANITIZE
|
#if HB_DEBUG_SANITIZE
|
||||||
|
|
Loading…
Reference in New Issue