if (blob->mode == HB_MEMORY_MODE_DUPLICATE) {
blob->mode = HB_MEMORY_MODE_READONLY;
- if (!hb_blob_try_writeable (blob)) {
+ if (!hb_blob_try_writable (blob)) {
hb_blob_destroy (blob);
return &_hb_blob_nil;
}
}
hb_bool_t
-hb_blob_is_writeable (hb_blob_t *blob)
+hb_blob_is_writable (hb_blob_t *blob)
{
hb_memory_mode_t mode;
hb_mutex_unlock (blob->lock);
- return mode == HB_MEMORY_MODE_WRITEABLE;
+ return mode == HB_MEMORY_MODE_WRITABLE;
}
static hb_bool_t
-_try_make_writeable_inplace_unix_locked (hb_blob_t *blob)
+_try_make_writable_inplace_unix_locked (hb_blob_t *blob)
{
#if defined(HAVE_SYS_MMAN_H) && defined(HAVE_MPROTECT)
unsigned int pagesize = -1, mask, length;
}
#if HB_DEBUG
- fprintf (stderr, "%p %s: successfully made [%p..%p] (%d bytes) writeable\n",
+ fprintf (stderr, "%p %s: successfully made [%p..%p] (%d bytes) writable\n",
blob, __FUNCTION__,
addr, addr+length, length);
#endif
hb_bool_t
-hb_blob_try_writeable_inplace (hb_blob_t *blob)
+hb_blob_try_writable_inplace (hb_blob_t *blob)
{
hb_memory_mode_t mode;
hb_mutex_lock (blob->lock);
- if (blob->mode == HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITEABLE) {
+ if (blob->mode == HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE) {
#if HB_DEBUG
- fprintf (stderr, "%p %s: making writeable\n", blob, __FUNCTION__);
+ fprintf (stderr, "%p %s: making writable\n", blob, __FUNCTION__);
#endif
- if (_try_make_writeable_inplace_unix_locked (blob)) {
+ if (_try_make_writable_inplace_unix_locked (blob)) {
#if HB_DEBUG
- fprintf (stderr, "%p %s: making writeable -> succeeded\n", blob, __FUNCTION__);
+ fprintf (stderr, "%p %s: making writable -> succeeded\n", blob, __FUNCTION__);
#endif
- blob->mode = HB_MEMORY_MODE_WRITEABLE;
+ blob->mode = HB_MEMORY_MODE_WRITABLE;
} else {
#if HB_DEBUG
- fprintf (stderr, "%p %s: making writeable -> FAILED\n", blob, __FUNCTION__);
+ fprintf (stderr, "%p %s: making writable -> FAILED\n", blob, __FUNCTION__);
#endif
- /* Failed to make writeable inplace, mark that */
+ /* Failed to make writable inplace, mark that */
blob->mode = HB_MEMORY_MODE_READONLY;
}
}
hb_mutex_unlock (blob->lock);
- return mode == HB_MEMORY_MODE_WRITEABLE;
+ return mode == HB_MEMORY_MODE_WRITABLE;
}
hb_bool_t
-hb_blob_try_writeable (hb_blob_t *blob)
+hb_blob_try_writable (hb_blob_t *blob)
{
hb_memory_mode_t mode;
#endif
memcpy (new_data, blob->data, blob->length);
blob->data = new_data;
- blob->mode = HB_MEMORY_MODE_WRITEABLE;
+ blob->mode = HB_MEMORY_MODE_WRITABLE;
_hb_blob_destroy_user_data (blob);
}
}
hb_mutex_unlock (blob->lock);
- if (blob->mode == HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITEABLE)
- return hb_blob_try_writeable_inplace (blob);
+ if (blob->mode == HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE)
+ return hb_blob_try_writable_inplace (blob);
- return mode == HB_MEMORY_MODE_WRITEABLE;
+ return mode == HB_MEMORY_MODE_WRITABLE;
}
typedef enum {
HB_MEMORY_MODE_DUPLICATE,
HB_MEMORY_MODE_READONLY,
- HB_MEMORY_MODE_WRITEABLE,
+ HB_MEMORY_MODE_WRITABLE,
HB_MEMORY_MODE_READONLY_NEVER_DUPLICATE,
- HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITEABLE
+ HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE
} hb_memory_mode_t;
typedef struct _hb_blob_t hb_blob_t;
hb_blob_unlock (hb_blob_t *blob);
hb_bool_t
-hb_blob_is_writeable (hb_blob_t *blob);
+hb_blob_is_writable (hb_blob_t *blob);
hb_bool_t
-hb_blob_try_writeable_inplace (hb_blob_t *blob);
+hb_blob_try_writable_inplace (hb_blob_t *blob);
hb_bool_t
-hb_blob_try_writeable (hb_blob_t *blob);
+hb_blob_try_writable (hb_blob_t *blob);
HB_END_DECLS
const char *base HB_GNUC_UNUSED,
unsigned int len HB_GNUC_UNUSED)
{
- bool perm = hb_blob_try_writeable_inplace (context->blob);
+ bool perm = hb_blob_try_writable_inplace (context->blob);
context->edit_count++;
#if HB_DEBUG
} else {
unsigned int edit_count = context.edit_count;
_hb_sanitize_fini (&context, true);
- if (edit_count && !hb_blob_is_writeable (blob) && hb_blob_try_writeable (blob)) {
- /* ok, we made it writeable by relocating. try again */
+ if (edit_count && !hb_blob_is_writable (blob) && hb_blob_try_writable (blob)) {
+ /* ok, we made it writable by relocating. try again */
#if HB_DEBUG
fprintf (stderr, "Sanitizer %p retry %s\n", blob, __PRETTY_FUNCTION__);
#endif