Minor
[framework/uifw/harfbuzz.git] / src / hb-buffer-private.hh
index f544c82..8f2095a 100644 (file)
@@ -66,13 +66,15 @@ struct _hb_buffer_t {
   unsigned int len; /* Length of ->info and ->pos arrays */
   unsigned int out_len; /* Length of ->out array if have_output */
 
-  unsigned int serial;
-
   unsigned int allocated; /* Length of allocated arrays */
   hb_glyph_info_t     *info;
   hb_glyph_info_t     *out_info;
   hb_glyph_position_t *pos;
 
+  unsigned int serial;
+  uint8_t allocated_var_bytes[8];
+  const char *allocated_var_owner[8];
+
 
   /* Methods */
 
@@ -82,6 +84,10 @@ struct _hb_buffer_t {
   { return have_output? out_len : idx; }
   inline unsigned int next_serial (void) { return serial++; }
 
+  HB_INTERNAL void allocate_var (unsigned int byte_i, unsigned int count, const char *owner);
+  HB_INTERNAL void deallocate_var (unsigned int byte_i, unsigned int count, const char *owner);
+  HB_INTERNAL void deallocate_var_all (void);
+
   HB_INTERNAL void add (hb_codepoint_t  codepoint,
                        hb_mask_t       mask,
                        unsigned int    cluster);
@@ -132,6 +138,15 @@ struct _hb_buffer_t {
 };
 
 
+#define HB_BUFFER_XALLOCATE_VAR(b, func, var, owner) \
+  b->func (offsetof (hb_glyph_info_t, var) - offsetof(hb_glyph_info_t, var1), \
+          sizeof (b->info[0].var), owner)
+#define HB_BUFFER_ALLOCATE_VAR(b, var) \
+       HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var (), #var)
+#define HB_BUFFER_DEALLOCATE_VAR(b, var) \
+       HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var (), #var)
+
+
 HB_END_DECLS
 
 #endif /* HB_BUFFER_PRIVATE_HH */