summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2015-12-24 11:27:47 +0400
committerKhaled Hosny <khaledhosny@eglug.org>2015-12-24 11:27:47 +0400
commit3519ef07cf2b8610c30b22611466df0de2f74b19 (patch)
tree6f2395d7de889153b964cd4a3358e101b2922771
parent9d8c69b4aea7302391b1cafb3c1fa5c3d8c95198 (diff)
downloadfribidi-3519ef07cf2b8610c30b22611466df0de2f74b19.tar.gz
Remove custom memory allocator
It have been disabled in the last release, so it just complicates the code for no reason.
-rw-r--r--configure.ac3
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/fribidi-bidi.c1
-rw-r--r--lib/fribidi-joining.c1
-rw-r--r--lib/fribidi-mem.c140
-rw-r--r--lib/fribidi-run.c38
-rw-r--r--lib/fribidi.c3
-rw-r--r--lib/mem.h97
8 files changed, 0 insertions, 285 deletions
diff --git a/configure.ac b/configure.ac
index 8d20a4a..ac80e09 100644
--- a/configure.ac
+++ b/configure.ac
@@ -155,9 +155,6 @@ else
fi
AC_SUBST(FRIBIDI_NO_DEPRECATED)
-AC_DEFINE(USE_SIMPLE_MALLOC,1,
- [Define to 1 if you want to use simple mallocs instead of memory chunks])
-
# --disable-charsets
AC_ARG_ENABLE(charsets,
AC_HELP_STRING([--disable-charsets],
diff --git a/lib/Makefile.am b/lib/Makefile.am
index f96bc6d..30496b1 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -43,13 +43,11 @@ libfribidi_la_SOURCES = \
fribidi-deprecated.c \
fribidi-joining.c \
fribidi-joining-types.c \
- fribidi-mem.c \
fribidi-mirroring.c \
fribidi-run.c \
fribidi-shape.c \
joining-type.tab.i \
joining-types.h \
- mem.h \
mirroring.tab.i \
run.h
diff --git a/lib/fribidi-bidi.c b/lib/fribidi-bidi.c
index 1bea6e8..a48f8c9 100644
--- a/lib/fribidi-bidi.c
+++ b/lib/fribidi-bidi.c
@@ -39,7 +39,6 @@
#include <fribidi-mirroring.h>
#include <fribidi-unicode.h>
-#include "mem.h"
#include "bidi-types.h"
#include "run.h"
diff --git a/lib/fribidi-joining.c b/lib/fribidi-joining.c
index 29d0b67..90f0c0c 100644
--- a/lib/fribidi-joining.c
+++ b/lib/fribidi-joining.c
@@ -35,7 +35,6 @@
#include <fribidi-joining.h>
-#include "mem.h"
#include "bidi-types.h"
#include "joining-types.h"
diff --git a/lib/fribidi-mem.c b/lib/fribidi-mem.c
deleted file mode 100644
index e1472cf..0000000
--- a/lib/fribidi-mem.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/* FriBidi
- * fribidi-mem.c - memory manipulation routines
- *
- * $Id: fribidi-mem.c,v 1.8 2006-01-31 03:23:13 behdad Exp $
- * $Author: behdad $
- * $Date: 2006-01-31 03:23:13 $
- * $Revision: 1.8 $
- * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-mem.c,v $
- *
- * Authors:
- * Behdad Esfahbod, 2001, 2002, 2004
- *
- * Copyright (C) 2004 Sharif FarsiWeb, Inc
- * Copyright (C) 2001,2002 Behdad Esfahbod
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library, in a file named COPYING; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA
- *
- * For licensing issues, contact <license@farsiweb.info>.
- */
-
-#include "common.h"
-
-#include "mem.h"
-
-#if FRIBIDI_USE_GLIB+0
-#else
-#if USE_SIMPLE_MALLOC+0
-#else
-
-struct _FriBidiMemChunk
-{
- int atom_size;
- int area_size;
- int empty_size;
- void *chunk;
-};
-
-FriBidiMemChunk *
-fribidi_mem_chunk_new (
- /* input */
- const char *name,
- int atom_size,
- unsigned long area_size,
- int alloc_type
-)
-{
- register FriBidiMemChunk *m;
-
- fribidi_assert (area_size >= atom_size * 8);
-
- m = (FriBidiMemChunk *) fribidi_malloc (sizeof (FriBidiMemChunk));
- if LIKELY
- (m)
- {
- m->atom_size = atom_size;
- m->area_size = area_size;
- m->empty_size = 0;
- m->chunk = NULL;
- }
-
- return m;
-}
-
-void *
-fribidi_mem_chunk_alloc (
- /* input */
- FriBidiMemChunk *mem_chunk
-)
-{
- fribidi_assert (mem_chunk);
-
- if UNLIKELY
- (mem_chunk->empty_size < mem_chunk->atom_size)
- {
- register void *chunk = fribidi_malloc (mem_chunk->area_size);
- if LIKELY
- (chunk)
- {
- if (mem_chunk->chunk)
- *(void **) chunk =
- (char *) mem_chunk->chunk + mem_chunk->empty_size -
- mem_chunk->area_size;
- chunk = (char *) chunk + mem_chunk->atom_size;
- mem_chunk->chunk = chunk;
- mem_chunk->empty_size = mem_chunk->area_size - mem_chunk->atom_size;
- }
- else
- return NULL;
- }
-
- {
- register void *m = mem_chunk->chunk;
- mem_chunk->chunk = (char *) mem_chunk->chunk + mem_chunk->atom_size;
- mem_chunk->empty_size -= mem_chunk->atom_size;
-
- return m;
- }
-}
-
-void
-fribidi_mem_chunk_destroy (
- /* input */
- FriBidiMemChunk *mem_chunk
-)
-{
- register void *chunk;
-
- fribidi_assert (mem_chunk);
-
- chunk =
- (char *) mem_chunk->chunk + mem_chunk->empty_size - mem_chunk->area_size;
- while LIKELY
- (chunk)
- {
- register void *tofree = chunk;
- chunk = *(void **) chunk;
- fribidi_free (tofree);
- }
- fribidi_free (mem_chunk);
-}
-
-#endif /* !USE_SIMPLE_MALLOC */
-#endif /* !FRIBIDI_USE_GLIB */
-
-/* Editor directions:
- * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
- */
diff --git a/lib/fribidi-run.c b/lib/fribidi-run.c
index 9219ff9..3819833 100644
--- a/lib/fribidi-run.c
+++ b/lib/fribidi-run.c
@@ -38,14 +38,8 @@
#include <fribidi-bidi-types.h>
#include "run.h"
-#include "mem.h"
#include "bidi-types.h"
-#if USE_SIMPLE_MALLOC+0
-#else
-static FriBidiRun *free_runs = NULL;
-#endif
-
FriBidiRun *
new_run (
void
@@ -53,29 +47,7 @@ new_run (
{
register FriBidiRun *run;
-#if USE_SIMPLE_MALLOC+0
run = fribidi_malloc (sizeof (FriBidiRun));
-#else /* !USE_SIMPLE_MALLOC */
- if (free_runs)
- {
- run = free_runs;
- free_runs = run->next;
- }
- else
- {
- static FriBidiMemChunk *run_mem_chunk = NULL;
-
- if UNLIKELY
- (!run_mem_chunk)
- run_mem_chunk = fribidi_chunk_new_for_type (FriBidiRun);
-
- if LIKELY
- (run_mem_chunk)
- run = fribidi_chunk_new (FriBidiRun, run_mem_chunk);
- else
- run = NULL;
- }
-#endif /* !USE_SIMPLE_MALLOC */
if LIKELY
(run)
@@ -93,12 +65,7 @@ free_run (
)
{
fribidi_assert (run);
-#if USE_SIMPLE_MALLOC+0
fribidi_free (run);
-#else /* !USE_SIMPLE_MALLOC */
- run->next = free_runs;
- free_runs = run;
-#endif /* !USE_SIMPLE_MALLOC */
}
FriBidiRun *
@@ -133,7 +100,6 @@ free_run_list (
fribidi_validate_run_list (run_list);
-#if USE_SIMPLE_MALLOC+0
{
register FriBidiRun *pp;
@@ -149,10 +115,6 @@ free_run_list (
free_run (p);
};
}
-#else /* !USE_SIMPLE_MALLOC */
- run_list->prev->next = free_runs;
- free_runs = run_list;
-#endif /* !USE_SIMPLE_MALLOC */
}
diff --git a/lib/fribidi.c b/lib/fribidi.c
index b09b962..36b84ee 100644
--- a/lib/fribidi.c
+++ b/lib/fribidi.c
@@ -78,9 +78,6 @@ const char *fribidi_version_info =
#if DEBUG+0
" --enable-debug"
#endif /* DEBUG */
-#if USE_SIMPLE_MALLOC+0
- " --enable-malloc"
-#endif /* USE_SIMPLE_MALLOC */
#if FRIBIDI_CHARSETS+0
#else
" --disable-charsets"
diff --git a/lib/mem.h b/lib/mem.h
deleted file mode 100644
index ae6d3cd..0000000
--- a/lib/mem.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* FriBidi
- * mem.h - memory manipulation routines
- *
- * $Id: mem.h,v 1.7 2006-01-31 03:23:13 behdad Exp $
- * $Author: behdad $
- * $Date: 2006-01-31 03:23:13 $
- * $Revision: 1.7 $
- * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/mem.h,v $
- *
- * Author:
- * Behdad Esfahbod, 2001, 2002, 2004
- *
- * Copyright (C) 2004 Sharif FarsiWeb, Inc
- * Copyright (C) 2001,2002 Behdad Esfahbod
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library, in a file named COPYING; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA
- *
- * For licensing issues, contact <license@farsiweb.info>.
- */
-#ifndef _MEM_H
-#define _MEM_H
-
-#include "common.h"
-
-#include <fribidi-types.h>
-
-#include <fribidi-begindecls.h>
-
-#if FRIBIDI_USE_GLIB+0
-
-#ifndef __FRIBIDI_DOC
-# include <glib.h>
-#endif /* !__FRIBIDI_DOC */
-
-#define FriBidiMemChunk GMemChunk
-#define FRIBIDI_ALLOC_ONLY G_ALLOC_ONLY
-#define fribidi_mem_chunk_new g_mem_chunk_new
-#define fribidi_mem_chunk_alloc g_mem_chunk_alloc
-#define fribidi_mem_chunk_destroy g_mem_chunk_destroy
-
-#else /* !FRIBIDI_USE_GLIB */
-
-typedef struct _FriBidiMemChunk FriBidiMemChunk;
-
-#define FRIBIDI_ALLOC_ONLY 1
-
-#define fribidi_mem_chunk_new FRIBIDI_PRIVATESPACE(mem_chunk_new)
-FriBidiMemChunk *
-fribidi_mem_chunk_new (
- const char *name,
- int atom_size,
- unsigned long area_size,
- int alloc_type
-)
- FRIBIDI_GNUC_HIDDEN FRIBIDI_GNUC_MALLOC FRIBIDI_GNUC_WARN_UNUSED;
-
-#define fribidi_mem_chunk_alloc FRIBIDI_PRIVATESPACE(mem_chunk_alloc)
- void *fribidi_mem_chunk_alloc (
- FriBidiMemChunk *mem_chunk
-)
- FRIBIDI_GNUC_HIDDEN FRIBIDI_GNUC_MALLOC FRIBIDI_GNUC_WARN_UNUSED;
-
-#define fribidi_mem_chunk_destroy FRIBIDI_PRIVATESPACE(mem_chunk_destroy)
- void fribidi_mem_chunk_destroy (
- FriBidiMemChunk *mem_chunk
-) FRIBIDI_GNUC_HIDDEN;
-
-#endif /* !FRIBIDI_USE_GLIB */
-
-#define fribidi_chunk_new(type, chunk) ( \
- (type *) fribidi_mem_chunk_alloc (chunk) \
- )
-
-#define fribidi_chunk_new_for_type(type) ( \
- fribidi_mem_chunk_new(FRIBIDI, sizeof (type), \
- FRIBIDI_CHUNK_SIZE, FRIBIDI_ALLOC_ONLY) \
- )
-
-#include <fribidi-enddecls.h>
-
-#endif /* !_MEM_H */
-/* Editor directions:
- * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
- */