[pango/harfbuzz-ng] [HB] Shuffle code around



commit 782943efe043e2bc1ecf973271505471b469f185
Author: Behdad Esfahbod <behdad behdad org>
Date:   Tue Aug 4 19:31:02 2009 -0400

    [HB] Shuffle code around

 pango/opentype/hb-open-types-private.hh |  127 ++++++++++++++++---------------
 1 files changed, 65 insertions(+), 62 deletions(-)
---
diff --git a/pango/opentype/hb-open-types-private.hh b/pango/opentype/hb-open-types-private.hh
index 8429179..fb7dca5 100644
--- a/pango/opentype/hb-open-types-private.hh
+++ b/pango/opentype/hb-open-types-private.hh
@@ -52,68 +52,6 @@
 
 
 /*
- * Sanitize
- */
-
-typedef struct _hb_sanitize_context_t hb_sanitize_context_t;
-struct _hb_sanitize_context_t
-{
-  const char *start, *end;
-  int edit_count;
-  hb_blob_t *blob;
-};
-
-static HB_GNUC_UNUSED void
-hb_sanitize_init (hb_sanitize_context_t *context,
-		  hb_blob_t *blob)
-{
-  context->blob = blob;
-  context->start = hb_blob_lock (blob);
-  context->end = context->start + hb_blob_get_length (blob);
-  context->edit_count = 0;
-}
-
-static HB_GNUC_UNUSED void
-hb_sanitize_fini (hb_sanitize_context_t *context, bool unlock)
-{
-  if (unlock)
-    hb_blob_unlock (context->blob);
-}
-
-static HB_GNUC_UNUSED bool
-hb_sanitize_edit (hb_sanitize_context_t *context)
-{
-  bool perm = hb_blob_try_writeable_inplace (context->blob);
-  if (perm)
-    context->edit_count++;
-  return perm;
-}
-
-#define SANITIZE_ARG_DEF \
-	hb_sanitize_context_t *context
-#define SANITIZE_ARG \
-	context
-
-#define SANITIZE(X) HB_LIKELY ((X).sanitize (SANITIZE_ARG))
-#define SANITIZE2(X,Y) (SANITIZE (X) && SANITIZE (Y))
-
-#define SANITIZE_THIS(X) HB_LIKELY ((X).sanitize (SANITIZE_ARG, CONST_CHARP(this)))
-#define SANITIZE_THIS2(X,Y) (SANITIZE_THIS (X) && SANITIZE_THIS (Y))
-#define SANITIZE_THIS3(X,Y,Z) (SANITIZE_THIS (X) && SANITIZE_THIS (Y) && SANITIZE_THIS(Z))
-
-#define SANITIZE_BASE(X,B) HB_LIKELY ((X).sanitize (SANITIZE_ARG, B))
-#define SANITIZE_BASE2(X,Y,B) (SANITIZE_BASE (X,B) && SANITIZE_BASE (Y,B))
-
-#define SANITIZE_SELF() SANITIZE_OBJ (*this)
-#define SANITIZE_OBJ(X) SANITIZE_MEM(&(X), sizeof (X))
-#define SANITIZE_GET_SIZE() SANITIZE_SELF() && SANITIZE_MEM (this, this->get_size ())
-
-#define SANITIZE_MEM(B,L) HB_LIKELY (context->start <= CONST_CHARP(B) && CONST_CHARP(B) + (L) <= context->end) /* XXX overflow */
-
-#define NEUTER(Var, Val) (SANITIZE_OBJ (Var) && hb_sanitize_edit (context) && ((Var) = (Val), true))
-
-
-/*
  * Array types
  */
 
@@ -169,6 +107,7 @@ hb_sanitize_edit (hb_sanitize_context_t *context)
   inline const Type& get_##name (unsigned int i) const { return (this+name##List)[i]; } \
   inline unsigned int get_##name##_count (void) const { return (this+name##List).len; }
 
+
 /*
  * Tag types
  */
@@ -203,6 +142,8 @@ hb_sanitize_edit (hb_sanitize_context_t *context)
       return Null(Type); \
   }
 
+
+
 /*
  * Class features
  */
@@ -258,6 +199,68 @@ struct Null <Type> \
   }
 
 
+/*
+ * Sanitize
+ */
+
+typedef struct _hb_sanitize_context_t hb_sanitize_context_t;
+struct _hb_sanitize_context_t
+{
+  const char *start, *end;
+  int edit_count;
+  hb_blob_t *blob;
+};
+
+static HB_GNUC_UNUSED void
+hb_sanitize_init (hb_sanitize_context_t *context,
+		  hb_blob_t *blob)
+{
+  context->blob = blob;
+  context->start = hb_blob_lock (blob);
+  context->end = context->start + hb_blob_get_length (blob);
+  context->edit_count = 0;
+}
+
+static HB_GNUC_UNUSED void
+hb_sanitize_fini (hb_sanitize_context_t *context, bool unlock)
+{
+  if (unlock)
+    hb_blob_unlock (context->blob);
+}
+
+static HB_GNUC_UNUSED bool
+hb_sanitize_edit (hb_sanitize_context_t *context)
+{
+  bool perm = hb_blob_try_writeable_inplace (context->blob);
+  if (perm)
+    context->edit_count++;
+  return perm;
+}
+
+#define SANITIZE_ARG_DEF \
+	hb_sanitize_context_t *context
+#define SANITIZE_ARG \
+	context
+
+#define SANITIZE(X) HB_LIKELY ((X).sanitize (SANITIZE_ARG))
+#define SANITIZE2(X,Y) (SANITIZE (X) && SANITIZE (Y))
+
+#define SANITIZE_THIS(X) HB_LIKELY ((X).sanitize (SANITIZE_ARG, CONST_CHARP(this)))
+#define SANITIZE_THIS2(X,Y) (SANITIZE_THIS (X) && SANITIZE_THIS (Y))
+#define SANITIZE_THIS3(X,Y,Z) (SANITIZE_THIS (X) && SANITIZE_THIS (Y) && SANITIZE_THIS(Z))
+
+#define SANITIZE_BASE(X,B) HB_LIKELY ((X).sanitize (SANITIZE_ARG, B))
+#define SANITIZE_BASE2(X,Y,B) (SANITIZE_BASE (X,B) && SANITIZE_BASE (Y,B))
+
+#define SANITIZE_SELF() SANITIZE_OBJ (*this)
+#define SANITIZE_OBJ(X) SANITIZE_MEM(&(X), sizeof (X))
+#define SANITIZE_GET_SIZE() SANITIZE_SELF() && SANITIZE_MEM (this, this->get_size ())
+
+#define SANITIZE_MEM(B,L) HB_LIKELY (context->start <= CONST_CHARP(B) && CONST_CHARP(B) + (L) <= context->end) /* XXX overflow */
+
+#define NEUTER(Var, Val) (SANITIZE_OBJ (Var) && hb_sanitize_edit (context) && ((Var) = (Val), true))
+
+
 
 /*
  *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]