summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2005-12-05 20:22:24 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2005-12-05 20:22:24 +0000
commitc574499f78c820c3057e017754ae38da2bcf4299 (patch)
tree71b840bf812129b93263d5d597f963ba06362d0c
parent8d74e8313c49bfcad0c957274048daba94f067df (diff)
downloadpango-c574499f78c820c3057e017754ae38da2bcf4299.tar.gz
Use new g_slice API for TypeLink allocation, instead of GMemChunks.
2005-12-05 Behdad Esfahbod <behdad@gnome.org> * pango/mini-fribidi/fribidi.c, pango/mini-fribidi/fribidi_config.h, pango/mini-fribidi/fribidi.patch: Use new g_slice API for TypeLink allocation, instead of GMemChunks. * configure.in: Bump required glib version to 2.9.1.
-rw-r--r--ChangeLog8
-rw-r--r--configure.in2
-rw-r--r--pango/mini-fribidi/fribidi.c59
-rw-r--r--pango/mini-fribidi/fribidi.patch129
-rw-r--r--pango/mini-fribidi/fribidi_config.h11
5 files changed, 98 insertions, 111 deletions
diff --git a/ChangeLog b/ChangeLog
index 0440e4e2..6ad37bd9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2005-12-05 Behdad Esfahbod <behdad@gnome.org>
+
+ * pango/mini-fribidi/fribidi.c, pango/mini-fribidi/fribidi_config.h,
+ pango/mini-fribidi/fribidi.patch: Use new g_slice API for TypeLink
+ allocation, instead of GMemChunks.
+
+ * configure.in: Bump required glib version to 2.9.1.
+
2005-12-04 Behdad Esfahbod <behdad@gnome.org>
* modules/basic/basic-fc.c: Return NULL, not FALSE!
diff --git a/configure.in b/configure.in
index 51d53547..80e2d30d 100644
--- a/configure.in
+++ b/configure.in
@@ -326,7 +326,7 @@ fi
#
# Checks for GLib
#
-GLIB_REQUIRED_VERSION=2.9.0
+GLIB_REQUIRED_VERSION=2.9.1
GLIB_MODULES="glib-2.0 >= $GLIB_REQUIRED_VERSION gobject-2.0 gmodule-no-export-2.0"
PKG_CHECK_MODULES(GLIB, $GLIB_MODULES, :,
diff --git a/pango/mini-fribidi/fribidi.c b/pango/mini-fribidi/fribidi.c
index 4d9c0b98..e38dbad2 100644
--- a/pango/mini-fribidi/fribidi.c
+++ b/pango/mini-fribidi/fribidi.c
@@ -67,54 +67,20 @@ typedef struct
}
LevelInfo;
-#ifndef USE_SIMPLE_MALLOC
-static TypeLink *free_type_links = NULL;
-#endif
-
static TypeLink *
new_type_link (void)
{
TypeLink *link;
-#ifdef USE_SIMPLE_MALLOC
- link = malloc (sizeof (TypeLink));
-#else /* !USE_SIMPLE_MALLOC */
- if (free_type_links)
- {
- link = free_type_links;
- free_type_links = free_type_links->next;
- }
- else
- {
- static FriBidiMemChunk *mem_chunk = NULL;
-
- if (!mem_chunk)
- mem_chunk = fribidi_mem_chunk_create (TypeLink,
- FRIBIDI_CHUNK_SIZE,
- FRIBIDI_ALLOC_ONLY);
+ link = g_slice_new0 (TypeLink);
- link = fribidi_chunk_new (TypeLink,
- mem_chunk);
- }
-#endif /* !USE_SIMPLE_MALLOC */
-
- link->len = 0;
- link->pos = 0;
- link->level = 0;
- link->next = NULL;
- link->prev = NULL;
return link;
}
static void
free_type_link (TypeLink *link)
{
-#ifdef USE_SIMPLE_MALLOC
- free (link);
-#else
- link->next = free_type_links;
- free_type_links = link;
-#endif
+ g_slice_free (TypeLink, link);
}
#define FRIBIDI_ADD_TYPE_LINK(p,q) \
@@ -391,9 +357,6 @@ compact_neutrals (TypeLink *list)
static void
free_rl_list (TypeLink *type_rl_list)
{
-
- TypeLink *pp;
-
DBG ("Entering free_rl_list()\n");
if (!type_rl_list)
@@ -402,23 +365,7 @@ free_rl_list (TypeLink *type_rl_list)
return;
}
-#ifdef USE_SIMPLE_MALLOC
- pp = type_rl_list;
- while (pp)
- {
- TypeLink *p;
-
- p = pp;
- pp = pp->next;
- free_type_link (p);
- };
-#else
- for (pp = type_rl_list->next; pp->next; pp = pp->next)
- /* Nothing */ ;
- pp->next = free_type_links;
- free_type_links = type_rl_list;
- type_rl_list = NULL;
-#endif
+ g_slice_free_chain (TypeLink, type_rl_list, next);
DBG ("Leaving free_rl_list()\n");
return;
diff --git a/pango/mini-fribidi/fribidi.patch b/pango/mini-fribidi/fribidi.patch
index 05ee878d..0975dbcb 100644
--- a/pango/mini-fribidi/fribidi.patch
+++ b/pango/mini-fribidi/fribidi.patch
@@ -1,7 +1,13 @@
diff -rua /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c ./fribidi.c
--- /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c 2005-09-25 18:50:30.000000000 -0400
-+++ ./fribidi.c 2005-11-03 11:30:26.000000000 -0500
-@@ -27,10 +27,6 @@
++++ fribidi.c 2005-12-05 11:35:07.000000000 -0500
+@@ -22,15 +22,12 @@
+ */
+
+ #include <stdlib.h>
++#include <string.h>
+
+ #ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "fribidi.h"
@@ -12,7 +18,7 @@ diff -rua /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c ./fribidi.c
/* Redefine FRIBIDI_CHUNK_SIZE in config.h to override this. */
#ifndef FRIBIDI_CHUNK_SIZE
-@@ -41,19 +37,8 @@
+@@ -41,19 +38,8 @@
#endif
#endif
@@ -32,7 +38,7 @@ diff -rua /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c ./fribidi.c
/*======================================================================
* Typedef for the run-length list.
-@@ -81,47 +66,6 @@
+@@ -81,95 +67,20 @@
}
LevelInfo;
@@ -77,10 +83,60 @@ diff -rua /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c ./fribidi.c
- }
-}
-
- #ifndef USE_SIMPLE_MALLOC
- static TypeLink *free_type_links = NULL;
- #endif
-@@ -181,12 +125,18 @@
+-#ifndef USE_SIMPLE_MALLOC
+-static TypeLink *free_type_links = NULL;
+-#endif
+-
+ static TypeLink *
+ new_type_link (void)
+ {
+ TypeLink *link;
+
+-#ifdef USE_SIMPLE_MALLOC
+- link = malloc (sizeof (TypeLink));
+-#else /* !USE_SIMPLE_MALLOC */
+- if (free_type_links)
+- {
+- link = free_type_links;
+- free_type_links = free_type_links->next;
+- }
+- else
+- {
+- static FriBidiMemChunk *mem_chunk = NULL;
+-
+- if (!mem_chunk)
+- mem_chunk = fribidi_mem_chunk_create (TypeLink,
+- FRIBIDI_CHUNK_SIZE,
+- FRIBIDI_ALLOC_ONLY);
+-
+- link = fribidi_chunk_new (TypeLink,
+- mem_chunk);
+- }
+-#endif /* !USE_SIMPLE_MALLOC */
++ link = g_slice_new0 (TypeLink);
+
+- link->len = 0;
+- link->pos = 0;
+- link->level = 0;
+- link->next = NULL;
+- link->prev = NULL;
+ return link;
+ }
+
+ static void
+ free_type_link (TypeLink *link)
+ {
+-#ifdef USE_SIMPLE_MALLOC
+- free (link);
+-#else
+- link->next = free_type_links;
+- free_type_links = link;
+-#endif
++ g_slice_free (TypeLink, link);
+ }
+
+ #define FRIBIDI_ADD_TYPE_LINK(p,q) \
+@@ -181,12 +92,18 @@
} while (0)
static TypeLink *
@@ -102,7 +158,7 @@ diff -rua /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c ./fribidi.c
/* Add the starting link */
list = new_type_link ();
-@@ -194,23 +144,38 @@
+@@ -194,23 +111,38 @@
list->level = FRIBIDI_LEVEL_START;
last = list;
@@ -146,7 +202,7 @@ diff -rua /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c ./fribidi.c
return list;
}
-@@ -418,6 +383,46 @@
+@@ -418,6 +350,27 @@
}
}
@@ -157,9 +213,6 @@ diff -rua /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c ./fribidi.c
+static void
+free_rl_list (TypeLink *type_rl_list)
+{
-+
-+ TypeLink *pp;
-+
+ DBG ("Entering free_rl_list()\n");
+
+ if (!type_rl_list)
@@ -168,23 +221,7 @@ diff -rua /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c ./fribidi.c
+ return;
+ }
+
-+#ifdef USE_SIMPLE_MALLOC
-+ pp = type_rl_list;
-+ while (pp)
-+ {
-+ TypeLink *p;
-+
-+ p = pp;
-+ pp = pp->next;
-+ free_type_link (p);
-+ };
-+#else
-+ for (pp = type_rl_list->next; pp->next; pp = pp->next)
-+ /* Nothing */ ;
-+ pp->next = free_type_links;
-+ free_type_links = type_rl_list;
-+ type_rl_list = NULL;
-+#endif
++ g_slice_free_chain (TypeLink, type_rl_list, next);
+
+ DBG ("Leaving free_rl_list()\n");
+ return;
@@ -193,7 +230,7 @@ diff -rua /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c ./fribidi.c
/*=========================================================================
* define macros for push and pop the status in to / out of the stack
*-------------------------------------------------------------------------*/
-@@ -512,95 +517,22 @@
+@@ -512,95 +465,22 @@
#define FRIBIDI_EMBEDDING_DIRECTION(list) \
FRIBIDI_LEVEL_TO_DIR(RL_LEVEL(list))
@@ -294,7 +331,7 @@ diff -rua /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c ./fribidi.c
TypeLink *type_rl_list, *explicits_list, *explicits_list_end, *pp;
DBG ("Entering fribidi_analyse_string()\n");
-@@ -608,14 +540,47 @@
+@@ -608,14 +488,53 @@
/* Determinate character types */
DBG (" Determine character types\n");
{
@@ -311,10 +348,16 @@ diff -rua /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c ./fribidi.c
+ type_rl_list = run_length_encode_types_utf8 (str, bytelen, len,
+ &ored_types, &anded_strongs);
+
-+ /* If there's absolutely nothing with a hint of rtl, then all resolved
-+ * levels will be ltr (even). short-circuit.
++ /* The case that all resolved levels will be ltr.
++ * First, all strongs should be ltr, and one of the following:
++ *
++ * o *pbase_dir doesn't have an rtl taste.
++ * o there are letters, and *pbase_dir is weak.
+ */
-+ if (!FRIBIDI_IS_RTL (*pbase_dir | ored_types))
++ if (!FRIBIDI_IS_RTL (ored_types) &&
++ (!FRIBIDI_IS_RTL (*pbase_dir) ||
++ (FRIBIDI_IS_WEAK (*pbase_dir) && FRIBIDI_IS_LETTER (ored_types))
++ ))
+ {
+ /* all ltr */
+ free_rl_list (type_rl_list);
@@ -348,7 +391,7 @@ diff -rua /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c ./fribidi.c
}
DBG (" Determine character types, Done\n");
-@@ -646,13 +611,6 @@
+@@ -646,13 +565,6 @@
DBG2 (" Base dir : %c\n", fribidi_char_from_type (base_dir));
DBG (" Finding the base level, Done\n");
@@ -362,7 +405,7 @@ diff -rua /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c ./fribidi.c
/* Explicit Levels and Directions */
DBG ("Explicit Levels and Directions\n");
{
-@@ -752,16 +710,6 @@
+@@ -752,16 +664,6 @@
compact_list (type_rl_list);
@@ -379,7 +422,7 @@ diff -rua /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c ./fribidi.c
/* 4. Resolving weak types */
DBG ("Resolving weak types\n");
{
-@@ -884,14 +832,6 @@
+@@ -884,14 +786,6 @@
compact_neutrals (type_rl_list);
@@ -394,7 +437,7 @@ diff -rua /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c ./fribidi.c
/* 5. Resolving Neutral Types */
DBG ("Resolving neutral types\n");
{
-@@ -916,14 +856,6 @@
+@@ -916,14 +810,6 @@
compact_list (type_rl_list);
@@ -409,7 +452,7 @@ diff -rua /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c ./fribidi.c
/* 6. Resolving implicit levels */
DBG ("Resolving implicit levels\n");
{
-@@ -952,15 +884,6 @@
+@@ -952,15 +838,6 @@
compact_list (type_rl_list);
@@ -425,7 +468,7 @@ diff -rua /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c ./fribidi.c
/* Reinsert the explicit codes & bn's that already removed, from the
explicits_list to type_rl_list. */
DBG ("Reinserting explicit codes\n");
-@@ -976,30 +899,23 @@
+@@ -976,30 +853,23 @@
p->level = p->prev->level;
}
@@ -461,7 +504,7 @@ diff -rua /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c ./fribidi.c
else
k = FRIBIDI_TYPE_ON;
if (!state && FRIBIDI_IS_SEPARATOR (k))
-@@ -1023,395 +939,59 @@
+@@ -1023,395 +893,59 @@
override_list (type_rl_list, list);
}
@@ -886,7 +929,7 @@ diff -rua /home/behdad/src/fdo/fribidi/fribidi.stable/fribidi.c ./fribidi.c
FriBidiLevel level = RL_LEVEL (pp);
for (i = 0; i < len; i++)
embedding_level_list[pos + i] = level;
-@@ -1420,34 +1000,6 @@
+@@ -1420,34 +954,6 @@
free_rl_list (type_rl_list);
DBG ("Leaving fribidi_log2vis_get_embedding_levels()\n");
diff --git a/pango/mini-fribidi/fribidi_config.h b/pango/mini-fribidi/fribidi_config.h
index 7eda848c..82e4da17 100644
--- a/pango/mini-fribidi/fribidi_config.h
+++ b/pango/mini-fribidi/fribidi_config.h
@@ -12,17 +12,6 @@
/* ripped off debugging functions, make sure it's not triggerred. */
#undef DEBUG
-/* fribidi's memchunk code was a reimplementation of glib's api.
- * use glib proper. */
-# include <glib/gmem.h>
-#define FriBidiMemChunk GMemChunk
-#define FRIBIDI_ALLOC_ONLY G_ALLOC_ONLY
-#define fribidi_mem_chunk_new g_mem_chunk_new
-#define fribidi_mem_chunk_create g_mem_chunk_create
-#define fribidi_mem_chunk_alloc g_mem_chunk_alloc
-#define fribidi_mem_chunk_destroy g_mem_chunk_destroy
-#define fribidi_chunk_new g_chunk_new
-
/* g_malloc and g_free verbatim */
#define malloc g_malloc
#define free g_free