libfontenc: Changes to 'debian-unstable'
.gitignore | 72 ++++++++++++++---
ChangeLog | 184 ++++++++++++++++++++++++++++++++++++++++++++
Makefile.am | 10 +-
configure.ac | 33 +++----
debian/changelog | 10 ++
debian/control | 3
debian/rules | 2
include/X11/fonts/fontenc.h | 2
src/Makefile.am | 7 -
src/encparse.c | 98 ++++++++---------------
src/fontenc.c | 36 ++------
src/fontencI.h | 2
12 files changed, 330 insertions(+), 129 deletions(-)
New commits:
commit 145bd1b18eaba77fbe72d3a891733b7c590984c5
Author: Cyril Brulebois <kibi@debian.org>
Date: Fri Nov 19 15:27:36 2010 +0100
Upload to unstable.
diff --git a/debian/changelog b/debian/changelog
index 93f8fa5..830dce6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-libfontenc (1:1.1.0-1) UNRELEASED; urgency=low
+libfontenc (1:1.1.0-1) unstable; urgency=low
* New upstream release.
* Bump xutils-dev build-dep for new macros.
@@ -6,7 +6,7 @@ libfontenc (1:1.1.0-1) UNRELEASED; urgency=low
* Switch from --list-missing to --fail-missing for additional safety.
* Exclude libfontenc.la from dh_install accordingly.
- -- Cyril Brulebois <kibi@debian.org> Fri, 19 Nov 2010 15:06:13 +0100
+ -- Cyril Brulebois <kibi@debian.org> Fri, 19 Nov 2010 15:27:29 +0100
libfontenc (1:1.0.5-2) unstable; urgency=low
commit 53730617abf7bc3ab72bb6e121f89c11992b639b
Author: Cyril Brulebois <kibi@debian.org>
Date: Fri Nov 19 15:22:26 2010 +0100
Exclude libfontenc.la from dh_install accordingly.
diff --git a/debian/changelog b/debian/changelog
index ed9cd98..93f8fa5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,7 @@ libfontenc (1:1.1.0-1) UNRELEASED; urgency=low
* Bump xutils-dev build-dep for new macros.
* Add xfonts-utils build-dep for font-util macros.
* Switch from --list-missing to --fail-missing for additional safety.
+ * Exclude libfontenc.la from dh_install accordingly.
-- Cyril Brulebois <kibi@debian.org> Fri, 19 Nov 2010 15:06:13 +0100
diff --git a/debian/rules b/debian/rules
index cdfd6f3..8c867eb 100755
--- a/debian/rules
+++ b/debian/rules
@@ -76,7 +76,7 @@ binary-arch: build install
dh_testroot
dh_installdocs
- dh_install --sourcedir=debian/tmp --fail-missing
+ dh_install --sourcedir=debian/tmp --fail-missing -Xlibfontenc.la
dh_installchangelogs ChangeLog
dh_link
dh_strip --dbg-package=$(PACKAGE)-dbg
commit 15513d565a1fdf22114ebe7a603cd78cfd5a0186
Author: Cyril Brulebois <kibi@debian.org>
Date: Fri Nov 19 15:18:54 2010 +0100
Switch from --list-missing to --fail-missing for additional safety.
diff --git a/debian/changelog b/debian/changelog
index fbdaff0..ed9cd98 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ libfontenc (1:1.1.0-1) UNRELEASED; urgency=low
* New upstream release.
* Bump xutils-dev build-dep for new macros.
* Add xfonts-utils build-dep for font-util macros.
+ * Switch from --list-missing to --fail-missing for additional safety.
-- Cyril Brulebois <kibi@debian.org> Fri, 19 Nov 2010 15:06:13 +0100
diff --git a/debian/rules b/debian/rules
index 3924b5c..cdfd6f3 100755
--- a/debian/rules
+++ b/debian/rules
@@ -76,7 +76,7 @@ binary-arch: build install
dh_testroot
dh_installdocs
- dh_install --sourcedir=debian/tmp --list-missing
+ dh_install --sourcedir=debian/tmp --fail-missing
dh_installchangelogs ChangeLog
dh_link
dh_strip --dbg-package=$(PACKAGE)-dbg
commit 7dce9d5668b67b522e957a539d36d6c012260b34
Author: Cyril Brulebois <kibi@debian.org>
Date: Fri Nov 19 15:17:38 2010 +0100
Add xfonts-utils build-dep for font-util macros.
diff --git a/debian/changelog b/debian/changelog
index 5ee1e4d..fbdaff0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ libfontenc (1:1.1.0-1) UNRELEASED; urgency=low
* New upstream release.
* Bump xutils-dev build-dep for new macros.
+ * Add xfonts-utils build-dep for font-util macros.
-- Cyril Brulebois <kibi@debian.org> Fri, 19 Nov 2010 15:06:13 +0100
diff --git a/debian/control b/debian/control
index e1fa964..2149c3c 100644
--- a/debian/control
+++ b/debian/control
@@ -11,6 +11,7 @@ Build-Depends:
automake,
libtool,
xutils-dev (>= 1:7.5~1),
+ xfonts-utils (>= 1:7.5+1),
Standards-Version: 3.8.4
Vcs-Git: git://git.debian.org/git/pkg-xorg/lib/libfontenc
Vcs-Browser: http://git.debian.org/?p=pkg-xorg/lib/libfontenc.git
commit 3df6eb9b12889d3a955fcd01cf904d946b045775
Author: Cyril Brulebois <kibi@debian.org>
Date: Fri Nov 19 15:12:31 2010 +0100
Bump xutils-dev build-dep for new macros.
diff --git a/debian/changelog b/debian/changelog
index e6b0550..5ee1e4d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
libfontenc (1:1.1.0-1) UNRELEASED; urgency=low
* New upstream release.
+ * Bump xutils-dev build-dep for new macros.
-- Cyril Brulebois <kibi@debian.org> Fri, 19 Nov 2010 15:06:13 +0100
diff --git a/debian/control b/debian/control
index be18a25..e1fa964 100644
--- a/debian/control
+++ b/debian/control
@@ -10,7 +10,7 @@ Build-Depends:
pkg-config,
automake,
libtool,
- xutils-dev (>= 1:7.4+4)
+ xutils-dev (>= 1:7.5~1),
Standards-Version: 3.8.4
Vcs-Git: git://git.debian.org/git/pkg-xorg/lib/libfontenc
Vcs-Browser: http://git.debian.org/?p=pkg-xorg/lib/libfontenc.git
commit a5753226b0c82bbfee782f616efea370c0e5b2e4
Author: Cyril Brulebois <kibi@debian.org>
Date: Fri Nov 19 15:07:46 2010 +0100
Update changelogs.
diff --git a/ChangeLog b/ChangeLog
index 54218cc..d0d32de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,187 @@
+commit a52174d1a7562a656559f9bb728a80982b814043
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Wed Oct 20 22:35:18 2010 -0700
+
+ libfontenc 1.1.0
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit af4a0a752c169b2c003978c550d57602af3fbe01
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Fri May 14 20:15:18 2010 -0700
+
+ Don't need to check if pointer is NULL before calling free()
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+ Reviewed-by: Jamey Sharp <jamey@minilop.net>
+
+commit 2218195ebb18b620f9e8e0adbea6f7c87ace33ce
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Fri May 14 20:09:21 2010 -0700
+
+ Replace malloc(strlen()) + strcpy() with strdup()
+
+ Now that we use malloc directly instead of xalloc, we can use
+ strdup directly too.
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+ Reviewed-by: Jamey Sharp <jamey@minilop.net>
+
+commit 4af0cf6ef7309df18c81a1fd109a168c767d9f3d
+Author: Mikhail Gusarov <dottedmag@dottedmag.net>
+Date: Mon May 10 22:52:42 2010 +0700
+
+ Nuke unnecessary casts
+
+ Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
+ Reviewed-by: Jamey Sharp <jamey@minilop.net>
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit cfc89d09f1bf0ecbe602578fc80dcf6fe46b1c54
+Author: Mikhail Gusarov <dottedmag@dottedmag.net>
+Date: Mon May 10 22:52:41 2010 +0700
+
+ Expand xalloc/xrealloc/xfree macros
+
+ Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
+ Reviewed-by: Jamey Sharp <jamey@minilop.net>
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 3db0064e4b6108716767b136ba5867c4cdf57f99
+Author: Mikhail Gusarov <dottedmag@dottedmag.net>
+Date: Mon May 10 22:52:40 2010 +0700
+
+ unifdef FONTENC_NO_LIBFONT
+
+ This symbol was unconditionally defined in Makefile
+ Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
+ Reviewed-by: Jamey Sharp <jamey@minilop.net>
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 8029fc07fc28e427979c81dd50087083e441d65d
+Author: Mikhail Gusarov <dottedmag@dottedmag.net>
+Date: Mon May 10 22:52:39 2010 +0700
+
+ Nuke RCS tags
+
+ Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
+ Reviewed-by: Jamey Sharp <jamey@minilop.net>
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 3e00a8c322ea5fd8ea21f83f5861c59aa91ce341
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Mon Mar 29 16:50:34 2010 -0400
+
+ config: update AC_PREREQ statement to 2.60
+
+ Unrelated to the previous patches, the new value simply reflects
+ the reality that the minimum level for autoconf to configure
+ all x.org modules is 2.60 dated June 2006.
+
+ ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz
+
+ Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 0191826dd2f0fc54dfce72ce729d142ddecbabcf
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Mon Mar 29 14:53:49 2010 -0400
+
+ config: remove the pkgconfig pc.in file from EXTRA_DIST
+
+ Automake always includes it in the tarball.
+
+ Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit d2d6e4d88b62aa84e2cc9d229adf32ede81cbf5c
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Tue Feb 16 10:37:21 2010 -0500
+
+ config: move CWARNFLAGS from configure.ac to Makefile.am
+
+ Compiler warning flags should be explicitly set in the makefile
+ rather than being merged with other packages compiler flags.
+
+ Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit b3807dccab5aee5455137654647c9c083addb31e
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Fri Nov 27 20:56:05 2009 -0500
+
+ Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES
+
+ Now that the INSTALL file is generated.
+ Allows running make maintainer-clean.
+
+commit 79c70fcf676778192e1d7bb0a194d75cb7227506
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Wed Oct 28 14:09:10 2009 -0400
+
+ INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206
+
+ Add missing INSTALL file. Use standard GNU file on building tarball
+ README may have been updated
+ Remove AUTHORS file as it is empty and no content available yet.
+ Remove NEWS file as it is empty and no content available yet.
+
+commit e7337c1598b8f258122a1f1307b3c83ab6c74a9c
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Tue Oct 27 15:07:25 2009 -0400
+
+ Deploy the new XORG_DEFAULT_OPTIONS #24242
+
+ This macro aggregate a number of existing macros that sets commmon
+ X.Org components configuration options. It shields the configuration file from
+ future changes.
+
+commit e3bd17c452be528f773bc976636ecc0c71bdba99
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Mon Oct 26 22:08:43 2009 -0400
+
+ Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432
+
+ ChangeLog filename is known to Automake and requires no further
+ coding in the makefile.
+
+commit e6631b8352ff83ee69c1076846b4500304d978eb
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Thu Oct 22 12:34:20 2009 -0400
+
+ .gitignore: use common defaults with custom section # 24239
+
+ Using common defaults will reduce errors and maintenance.
+ Only the very small or inexistent custom section need periodic maintenance
+ when the structure of the component changes. Do not edit defaults.
+
+commit 6210f1d458fa765699412b404fb88e40aeebf9e0
+Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
+Date: Wed Oct 21 12:47:27 2009 -0700
+
+ This is not a GNU project, so declare it foreign.
+
+ On Wed, 2009-10-21 at 13:36 +1000, Peter Hutterer wrote:
+ > On Tue, Oct 20, 2009 at 08:23:55PM -0700, Jeremy Huddleston wrote:
+ > > I noticed an INSTALL file in xlsclients and libXvMC today, and it
+ > > was quite annoying to work around since 'autoreconf -fvi' replaces
+ > > it and git wants to commit it. Should these files even be in git?
+ > > Can I nuke them for the betterment of humanity and since they get
+ > > created by autoreconf anyways?
+ >
+ > See https://bugs.freedesktop.org/show_bug.cgi?id=24206
+
+ As an interim measure, replace AM_INIT_AUTOMAKE([dist-bzip2]) with
+ AM_INIT_AUTOMAKE([foreign dist-bzip2]). This will prevent the generation
+ of the INSTALL file. It is also part of the 24206 solution.
+
+ Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
+
+commit eb4dbb8aac0858e1ee7169b2e0b90d5e3223de59
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date: Tue Oct 13 18:37:00 2009 -0700
+
+ Use font-utils 1.1 macros to find encodings path
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
commit e609e939f8b2573ac50bdd317733a2fef194965a
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri Aug 28 14:14:11 2009 +1000
diff --git a/debian/changelog b/debian/changelog
index 8a829af..e6b0550 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+libfontenc (1:1.1.0-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+
+ -- Cyril Brulebois <kibi@debian.org> Fri, 19 Nov 2010 15:06:13 +0100
+
libfontenc (1:1.0.5-2) unstable; urgency=low
[ Timo Aaltonen ]
commit a52174d1a7562a656559f9bb728a80982b814043
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Wed Oct 20 22:35:18 2010 -0700
libfontenc 1.1.0
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
diff --git a/configure.ac b/configure.ac
index fb806ac..fb0b1af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,9 @@ dnl Process this file with autoconf to create configure.
AC_PREREQ([2.60])
-AC_INIT(libfontenc, 1.0.5, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libfontenc)
+AC_INIT([libfontenc], [1.1.0],
+ [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
+ [libfontenc])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
commit af4a0a752c169b2c003978c550d57602af3fbe01
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri May 14 20:15:18 2010 -0700
Don't need to check if pointer is NULL before calling free()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
diff --git a/src/encparse.c b/src/encparse.c
index 33e0a05..5b4cefb 100644
--- a/src/encparse.c
+++ b/src/encparse.c
@@ -745,20 +745,19 @@ error:
if(encsize) free(enc); encsize=0;
if(namsize) {
for(i = first; i <= last; i++)
- if(nam[i])
- free(nam[i]);
+ free(nam[i]);
free(nam);
namsize = 0;
}
if(mapping) {
- if(mapping->client_data) free(mapping->client_data);
+ free(mapping->client_data);
free(mapping);
}
if(encoding) {
FontMapPtr nextmap;
- if (encoding->name) free(encoding->name);
+ free(encoding->name);
for (mapping = encoding->mappings; mapping; mapping = nextmap) {
- if (mapping->client_data) free(mapping->client_data);
+ free(mapping->client_data);
nextmap = mapping->next;
free(mapping);
}
@@ -930,8 +929,7 @@ FontEncIdentify(const char *fileName)
names = malloc((numaliases+2)*sizeof(char*));
if(names == NULL) {
- if(encoding->aliases)
- free(encoding->aliases);
+ free(encoding->aliases);
free(encoding);
return NULL;
}
diff --git a/src/fontenc.c b/src/fontenc.c
index 8718eff..86f5952 100644
--- a/src/fontenc.c
+++ b/src/fontenc.c
@@ -913,10 +913,8 @@ FontMapReverse(FontMapPtr mapping)
return reverse;
bail:
- if(map)
- free(map);
- if(reverse)
- free(reverse);
+ free(map);
+ free(reverse);
return NULL;
}
@@ -930,8 +928,7 @@ FontMapReverseFree(FontMapReversePtr delendum)
return;
for(i = 0; i < FONTENC_SEGMENTS; i++)
- if(map[i] != NULL)
- free(map[i]);
+ free(map[i]);
free(map);
return;
commit 2218195ebb18b620f9e8e0adbea6f7c87ace33ce
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri May 14 20:09:21 2010 -0700
Replace malloc(strlen()) + strcpy() with strdup()
Now that we use malloc directly instead of xalloc, we can use
strdup directly too.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
diff --git a/src/encparse.c b/src/encparse.c
index b288c8c..33e0a05 100644
--- a/src/encparse.c
+++ b/src/encparse.c
@@ -488,10 +488,9 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
encoding = malloc(sizeof(FontEncRec));
if(encoding == NULL)
goto error;
- encoding->name = malloc(strlen(keyword_value)+1);
+ encoding->name = strdup(keyword_value);
if(encoding->name == NULL)
goto error;
- strcpy(encoding->name, keyword_value);
encoding->size = 256;
encoding->row_size = 0;
encoding->mappings = NULL;
@@ -508,10 +507,9 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
case EOF_LINE: goto done;
case ALIAS_LINE:
if(numaliases < MAXALIASES) {
- aliases[numaliases] = malloc(strlen(keyword_value)+1);
+ aliases[numaliases] = strdup(keyword_value);
if(aliases[numaliases] == NULL)
goto error;
- strcpy(aliases[numaliases], keyword_value);
numaliases++;
}
goto no_mapping;
@@ -718,11 +716,10 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
nam[i]=NULL;
last = value1;
}
- nam[value1] = malloc(strlen(keyword_value)+1);
+ nam[value1] = strdup(keyword_value);
if(nam[value1] == NULL) {
goto error;
}
- strcpy(nam[value1], keyword_value);
goto string_mapping;
default: goto string_mapping; /* ignore unknown lines */
@@ -781,10 +778,9 @@ FontEncDirectory(void)
if(dir == NULL) {
char *c = getenv("FONT_ENCODINGS_DIRECTORY");
if(c) {
- dir = malloc(strlen(c) + 1);
+ dir = strdup(c);
if(!dir)
return NULL;
- strcpy(dir, c);
} else {
dir = FONT_ENCODINGS_DIRECTORY;
}
diff --git a/src/fontenc.c b/src/fontenc.c
index 1a24fc2..8718eff 100644
--- a/src/fontenc.c
+++ b/src/fontenc.c
@@ -753,10 +753,9 @@ FontEncLoad(const char *encoding_name, const char *filename)
char *new_name;
int numaliases = 0;
- new_name = malloc(strlen(encoding_name) + 1);
+ new_name = strdup(encoding_name);
if(new_name == NULL)
return NULL;
- strcpy(new_name, encoding_name);
if(encoding->aliases) {
for(alias = encoding->aliases; *alias; alias++)
numaliases++;
commit 4af0cf6ef7309df18c81a1fd109a168c767d9f3d
Author: Mikhail Gusarov <dottedmag@dottedmag.net>
Date: Mon May 10 22:52:42 2010 +0700
Nuke unnecessary casts
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
diff --git a/src/encparse.c b/src/encparse.c
index 5e31d9d..b288c8c 100644
--- a/src/encparse.c
+++ b/src/encparse.c
@@ -422,14 +422,14 @@ setCode(unsigned from, unsigned to, unsigned row_size,
return 0;
if(*encsize == 0) {
*encsize = (index < 256) ? 256 : 0x10000;
- *enc = (unsigned short*)malloc((*encsize) * sizeof(unsigned short));
+ *enc = malloc((*encsize) * sizeof(unsigned short));
if(*enc == NULL) {
*encsize = 0;
return 1;
}
} else if(*encsize <= index) {
*encsize = 0x10000;
- if((newenc = (unsigned short*)realloc(enc, *encsize))==NULL)
+ if((newenc = realloc(enc, *encsize))==NULL)
return 1;
*enc = newenc;
}
@@ -485,10 +485,10 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
case EOF_LINE:
goto error;
case STARTENCODING_LINE:
- encoding = (FontEncPtr)malloc(sizeof(FontEncRec));
+ encoding = malloc(sizeof(FontEncRec));
if(encoding == NULL)
goto error;
- encoding->name = (char*)malloc(strlen(keyword_value)+1);
+ encoding->name = malloc(strlen(keyword_value)+1);
if(encoding->name == NULL)
goto error;
strcpy(encoding->name, keyword_value);
@@ -508,7 +508,7 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
case EOF_LINE: goto done;
case ALIAS_LINE:
if(numaliases < MAXALIASES) {
- aliases[numaliases] = (char*)malloc(strlen(keyword_value)+1);
+ aliases[numaliases] = malloc(strlen(keyword_value)+1);
if(aliases[numaliases] == NULL)
goto error;
strcpy(aliases[numaliases], keyword_value);
@@ -527,7 +527,7 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
if(headerOnly)
goto done;
if(!strcasecmp(keyword_value, "unicode")) {
- mapping = (FontMapPtr)malloc(sizeof(FontMapRec));
+ mapping = malloc(sizeof(FontMapRec));
if(mapping == NULL)
goto error;
mapping->type = FONT_ENCODING_UNICODE;
@@ -539,7 +539,7 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
mapping->next = NULL;
goto mapping;
} else if(!strcasecmp(keyword_value, "cmap")) {
- mapping = (FontMapPtr)malloc(sizeof(FontMapRec));
+ mapping = malloc(sizeof(FontMapRec));
if(mapping == NULL)
goto error;
mapping->type = FONT_ENCODING_TRUETYPE;
@@ -551,7 +551,7 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
mapping->next = NULL;
goto mapping;
} else if(!strcasecmp(keyword_value, "postscript")) {
- mapping = (FontMapPtr)malloc(sizeof(FontMapRec));
+ mapping = malloc(sizeof(FontMapRec));
if(mapping == NULL)
goto error;
mapping->type = FONT_ENCODING_POSTSCRIPT;
@@ -588,8 +588,7 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
case ENDMAPPING_LINE:
mapping->recode = FontEncSimpleRecode;
mapping->name = FontEncUndefinedName;
- mapping->client_data = sm =
- (FontEncSimpleMapPtr)malloc(sizeof(FontEncSimpleMapRec));
+ mapping->client_data = sm = malloc(sizeof(FontEncSimpleMapRec));
if(sm == NULL)
goto error;
sm->row_size = encoding->row_size;
@@ -598,8 +597,7 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
sm->first = first;
sm->len=last-first+1;
- newmap =
- (unsigned short*)malloc(sm->len * sizeof(unsigned short));
+ newmap = malloc(sm->len * sizeof(unsigned short));
if(newmap == NULL) {
free(sm);
mapping->client_data = sm = NULL;
@@ -670,8 +668,7 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
case ENDMAPPING_LINE:
mapping->recode = FontEncUndefinedRecode;
mapping->name = FontEncSimpleName;
- mapping->client_data = sn =
- (FontEncSimpleNamePtr)malloc(sizeof(FontEncSimpleNameRec));
+ mapping->client_data = sn = malloc(sizeof(FontEncSimpleNameRec));
if(sn == NULL)
goto error;
if(first > last) {
@@ -681,7 +678,7 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
}
sn->first = first;
sn->len = last - first + 1;
- sn->map = (char**)malloc(sn->len*sizeof(char*));
+ sn->map = malloc(sn->len*sizeof(char*));
if(sn->map == NULL) {
free(sn);
mapping->client_data = sn = NULL;
@@ -697,7 +694,7 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
if(value1 >= 0x10000) goto string_mapping;
if(namsize == 0) {
namsize = (value1) < 256 ? 256 : 0x10000;
- nam = (char**)malloc(namsize * sizeof(char*));
+ nam = malloc(namsize * sizeof(char*));
if(nam == NULL) {
namsize=0;
goto error;
@@ -721,7 +718,7 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
nam[i]=NULL;
last = value1;
}
- nam[value1] = (char*)malloc(strlen(keyword_value)+1);
+ nam[value1] = malloc(strlen(keyword_value)+1);
if(nam[value1] == NULL) {
goto error;
}
@@ -737,7 +734,7 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
encoding->aliases=NULL;
if(numaliases) {
- encoding->aliases = (char**)malloc((numaliases+1)*sizeof(char*));
+ encoding->aliases = malloc((numaliases+1)*sizeof(char*));
if(encoding->aliases == NULL)
goto error;
for(i=0; i<numaliases; i++)
@@ -935,7 +932,7 @@ FontEncIdentify(const char *fileName)
for(alias = encoding->aliases; *alias; alias++)
numaliases++;
- names = (char**)malloc((numaliases+2)*sizeof(char*));
+ names = malloc((numaliases+2)*sizeof(char*));
if(names == NULL) {
if(encoding->aliases)
free(encoding->aliases);
diff --git a/src/fontenc.c b/src/fontenc.c
index 77c4f89..1a24fc2 100644
--- a/src/fontenc.c
+++ b/src/fontenc.c
@@ -761,7 +761,7 @@ FontEncLoad(const char *encoding_name, const char *filename)
for(alias = encoding->aliases; *alias; alias++)
numaliases++;
}
- new_aliases = (char**)malloc((numaliases+2)*sizeof(char*));
+ new_aliases = malloc((numaliases+2)*sizeof(char*));
if(new_aliases == NULL) {
free(new_name);
return NULL;
commit cfc89d09f1bf0ecbe602578fc80dcf6fe46b1c54
Author: Mikhail Gusarov <dottedmag@dottedmag.net>
Date: Mon May 10 22:52:41 2010 +0700
Expand xalloc/xrealloc/xfree macros
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
diff --git a/src/encparse.c b/src/encparse.c
index 27215df..5e31d9d 100644
--- a/src/encparse.c
+++ b/src/encparse.c
@@ -35,9 +35,6 @@ THE SOFTWARE.
#endif
#include <stdlib.h>
-#define xalloc(n) malloc(n)
-#define xrealloc(p, n) realloc(p, n)
-#define xfree(p) free(p)
#include "zlib.h"
typedef gzFile FontFilePtr;
@@ -425,14 +422,14 @@ setCode(unsigned from, unsigned to, unsigned row_size,
return 0;
if(*encsize == 0) {
*encsize = (index < 256) ? 256 : 0x10000;
- *enc = (unsigned short*)xalloc((*encsize) * sizeof(unsigned short));
+ *enc = (unsigned short*)malloc((*encsize) * sizeof(unsigned short));
if(*enc == NULL) {
*encsize = 0;
return 1;
}
} else if(*encsize <= index) {
*encsize = 0x10000;
- if((newenc = (unsigned short*)xrealloc(enc, *encsize))==NULL)
+ if((newenc = (unsigned short*)realloc(enc, *encsize))==NULL)
return 1;
*enc = newenc;
}
@@ -488,10 +485,10 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
case EOF_LINE:
goto error;
case STARTENCODING_LINE:
- encoding = (FontEncPtr)xalloc(sizeof(FontEncRec));
+ encoding = (FontEncPtr)malloc(sizeof(FontEncRec));
if(encoding == NULL)
goto error;
- encoding->name = (char*)xalloc(strlen(keyword_value)+1);
+ encoding->name = (char*)malloc(strlen(keyword_value)+1);
if(encoding->name == NULL)
goto error;
strcpy(encoding->name, keyword_value);
@@ -511,7 +508,7 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
case EOF_LINE: goto done;
case ALIAS_LINE:
if(numaliases < MAXALIASES) {
- aliases[numaliases] = (char*)xalloc(strlen(keyword_value)+1);
+ aliases[numaliases] = (char*)malloc(strlen(keyword_value)+1);
if(aliases[numaliases] == NULL)
goto error;
strcpy(aliases[numaliases], keyword_value);
@@ -530,7 +527,7 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
if(headerOnly)
goto done;
if(!strcasecmp(keyword_value, "unicode")) {
- mapping = (FontMapPtr)xalloc(sizeof(FontMapRec));
+ mapping = (FontMapPtr)malloc(sizeof(FontMapRec));
if(mapping == NULL)
goto error;
mapping->type = FONT_ENCODING_UNICODE;
@@ -542,7 +539,7 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
mapping->next = NULL;
goto mapping;
} else if(!strcasecmp(keyword_value, "cmap")) {
- mapping = (FontMapPtr)xalloc(sizeof(FontMapRec));
+ mapping = (FontMapPtr)malloc(sizeof(FontMapRec));
if(mapping == NULL)
goto error;
mapping->type = FONT_ENCODING_TRUETYPE;
@@ -554,7 +551,7 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
mapping->next = NULL;
goto mapping;
} else if(!strcasecmp(keyword_value, "postscript")) {
- mapping = (FontMapPtr)xalloc(sizeof(FontMapRec));
+ mapping = (FontMapPtr)malloc(sizeof(FontMapRec));
if(mapping == NULL)
goto error;
mapping->type = FONT_ENCODING_POSTSCRIPT;
@@ -592,7 +589,7 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
mapping->recode = FontEncSimpleRecode;
mapping->name = FontEncUndefinedName;
mapping->client_data = sm =
- (FontEncSimpleMapPtr)xalloc(sizeof(FontEncSimpleMapRec));
+ (FontEncSimpleMapPtr)malloc(sizeof(FontEncSimpleMapRec));
if(sm == NULL)
goto error;
sm->row_size = encoding->row_size;
@@ -602,9 +599,9 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
sm->first = first;
sm->len=last-first+1;
newmap =
- (unsigned short*)xalloc(sm->len * sizeof(unsigned short));
+ (unsigned short*)malloc(sm->len * sizeof(unsigned short));
if(newmap == NULL) {
- xfree(sm);
+ free(sm);
mapping->client_data = sm = NULL;
goto error;
}
@@ -674,19 +671,19 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
mapping->recode = FontEncUndefinedRecode;
mapping->name = FontEncSimpleName;
mapping->client_data = sn =
- (FontEncSimpleNamePtr)xalloc(sizeof(FontEncSimpleNameRec));
+ (FontEncSimpleNamePtr)malloc(sizeof(FontEncSimpleNameRec));
if(sn == NULL)
goto error;
if(first > last) {
- xfree(sn);
+ free(sn);
mapping->client_data = sn = NULL;
goto error;
}
sn->first = first;
sn->len = last - first + 1;
- sn->map = (char**)xalloc(sn->len*sizeof(char*));
+ sn->map = (char**)malloc(sn->len*sizeof(char*));
if(sn->map == NULL) {
- xfree(sn);
+ free(sn);
mapping->client_data = sn = NULL;
goto error;
}
@@ -700,14 +697,14 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
if(value1 >= 0x10000) goto string_mapping;
if(namsize == 0) {
namsize = (value1) < 256 ? 256 : 0x10000;
- nam = (char**)xalloc(namsize * sizeof(char*));
+ nam = (char**)malloc(namsize * sizeof(char*));
if(nam == NULL) {
namsize=0;
goto error;
}
} else if(namsize <= value1) {
namsize = 0x10000;
- if((newnam = (char**)xrealloc(nam, namsize)) == NULL)
+ if((newnam = (char**)realloc(nam, namsize)) == NULL)
goto error;
nam = newnam;
}
@@ -724,7 +721,7 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
nam[i]=NULL;
last = value1;
}
- nam[value1] = (char*)xalloc(strlen(keyword_value)+1);
+ nam[value1] = (char*)malloc(strlen(keyword_value)+1);
if(nam[value1] == NULL) {
goto error;
}
@@ -735,12 +732,12 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
}
done:
- if(encsize) xfree(enc); encsize=0; enc = NULL;
- if(namsize) xfree(nam); namsize=0; nam = NULL; /* don't free entries! */
+ if(encsize) free(enc); encsize=0; enc = NULL;
+ if(namsize) free(nam); namsize=0; nam = NULL; /* don't free entries! */
encoding->aliases=NULL;
if(numaliases) {
- encoding->aliases = (char**)xalloc((numaliases+1)*sizeof(char*));
+ encoding->aliases = (char**)malloc((numaliases+1)*sizeof(char*));
if(encoding->aliases == NULL)
goto error;
for(i=0; i<numaliases; i++)
@@ -751,30 +748,30 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
return encoding;
error:
- if(encsize) xfree(enc); encsize=0;
+ if(encsize) free(enc); encsize=0;
if(namsize) {
for(i = first; i <= last; i++)
if(nam[i])
- xfree(nam[i]);
- xfree(nam);
+ free(nam[i]);
+ free(nam);
namsize = 0;
}
if(mapping) {
- if(mapping->client_data) xfree(mapping->client_data);
- xfree(mapping);
+ if(mapping->client_data) free(mapping->client_data);
+ free(mapping);
}
if(encoding) {
FontMapPtr nextmap;
- if (encoding->name) xfree(encoding->name);
+ if (encoding->name) free(encoding->name);
for (mapping = encoding->mappings; mapping; mapping = nextmap) {
- if (mapping->client_data) xfree(mapping->client_data);
+ if (mapping->client_data) free(mapping->client_data);
nextmap = mapping->next;
- xfree(mapping);
+ free(mapping);
}
- xfree(encoding);
+ free(encoding);
}
for(i = 0; i < numaliases; i++)
- xfree(aliases[i]);
+ free(aliases[i]);
/* We don't need to free sn and sm as they handled locally in the body.*/
return NULL;
}
@@ -938,11 +935,11 @@ FontEncIdentify(const char *fileName)
for(alias = encoding->aliases; *alias; alias++)
numaliases++;
- names = (char**)xalloc((numaliases+2)*sizeof(char*));
+ names = (char**)malloc((numaliases+2)*sizeof(char*));
if(names == NULL) {
if(encoding->aliases)
- xfree(encoding->aliases);
- xfree(encoding);
+ free(encoding->aliases);
+ free(encoding);
return NULL;
}
@@ -953,8 +950,8 @@ FontEncIdentify(const char *fileName)
*name = *alias;
*name = NULL;
- xfree(encoding->aliases);
- xfree(encoding);
+ free(encoding->aliases);
+ free(encoding);
return names;
}
diff --git a/src/fontenc.c b/src/fontenc.c
index 76de4e3..77c4f89 100644
--- a/src/fontenc.c
+++ b/src/fontenc.c
@@ -29,9 +29,7 @@ THE SOFTWARE.
#endif
#include <stdlib.h>
-#define xalloc(n) malloc(n)
-#define xrealloc(p, n) realloc(p, n)
-#define xfree(p) free(p)
+
#define FALSE 0
#define TRUE 1
#define MAXFONTNAMELEN 1024
@@ -755,7 +753,7 @@ FontEncLoad(const char *encoding_name, const char *filename)
char *new_name;
int numaliases = 0;
- new_name = xalloc(strlen(encoding_name) + 1);
+ new_name = malloc(strlen(encoding_name) + 1);
if(new_name == NULL)
return NULL;
strcpy(new_name, encoding_name);
Reply to: