summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbehdad <behdad>2002-01-26 03:41:34 +0000
committerbehdad <behdad>2002-01-26 03:41:34 +0000
commit8304da5704fc298fed51a2d624f3d224a009fc0a (patch)
tree2b81e4e10dfcc4a48dfaa117d6bfc0eba89f2393
parentbd378675a83788f47725f4d66ef7d43e9e37b993 (diff)
Small code cleanup.
-rw-r--r--ChangeLog1
-rw-r--r--fribidi.c33
-rw-r--r--fribidi.spec.in23
-rw-r--r--fribidi_create_mirroring.c2
4 files changed, 33 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index 41634b9..a109f7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
2002-01-25 Behdad Esfahbod <behdad@bamdad.org>
* Makefile.am: Added fribidi.spec to distribution, to be able to make
RPMs from released distribution with 'rpm -tb'.
+ * fribidi.c: Added 'do { ... } while (0)' stuff around #defined codes.
2002-01-23 Behdad Esfahbod <behdad@bamdad.org>
* fribidi_create_char_types.c, fribidi_create_mirroring.c: Changed
diff --git a/fribidi.c b/fribidi.c
index 13bdf13..74928c8 100644
--- a/fribidi.c
+++ b/fribidi.c
@@ -41,8 +41,8 @@
#endif
#ifdef DEBUG
-#define DBG(s) if (fribidi_debug) { fprintf(stderr, s); }
-#define DBG2(s, t) if (fribidi_debug) { fprintf(stderr, s, t); }
+#define DBG(s) do { if (fribidi_debug) { fprintf(stderr, s); } } while (0)
+#define DBG2(s, t) do { if (fribidi_debug) { fprintf(stderr, s, t); } } while (0)
#else
#define DBG(s)
#define DBG2(s, t)
@@ -168,12 +168,12 @@ free_type_link (TypeLink *link)
}
#define FRIBIDI_ADD_TYPE_LINK(p,q) \
- { \
+ do { \
(p)->len = (q)->pos - (p)->pos; \
(p)->next = (q); \
(q)->prev = (p); \
(p) = (q); \
- }
+ } while (0)
static TypeLink *
run_length_encode_types (FriBidiCharType *char_type, FriBidiStrIndex type_len)
@@ -195,7 +195,8 @@ run_length_encode_types (FriBidiCharType *char_type, FriBidiStrIndex type_len)
link = new_type_link ();
link->type = char_type[i];
link->pos = i;
- FRIBIDI_ADD_TYPE_LINK (last, link)}
+ FRIBIDI_ADD_TYPE_LINK (last, link);
+ }
/* Add the ending link */
link = new_type_link ();
@@ -364,10 +365,10 @@ override_list (TypeLink *base, TypeLink *over)
}
/* Some convenience macros */
-#define RL_TYPE(list) (list)->type
-#define RL_LEN(list) (list)->len
-#define RL_POS(list) (list)->pos
-#define RL_LEVEL(list) (list)->level
+#define RL_TYPE(list) ((list)->type)
+#define RL_LEN(list) ((list)->len)
+#define RL_POS(list) ((list)->pos)
+#define RL_LEVEL(list) ((list)->level)
static TypeLink *
merge_with_prev (TypeLink *second)
@@ -437,7 +438,7 @@ compact_neutrals (TypeLink *list)
change the current level or override status.
*/
#define PUSH_STATUS \
- { \
+ do { \
if (new_level <= UNI_MAX_BIDI_LEVEL) \
{ \
if (level == UNI_MAX_BIDI_LEVEL - 1) \
@@ -449,13 +450,13 @@ compact_neutrals (TypeLink *list)
override = new_override; \
} else \
over_pushed++; \
- }
+ } while (0)
/* If there was a valid matching code, restore (pop) the last remembered
(pushed) embedding level and directional override.
*/
#define POP_STATUS \
- { \
+ do { \
if (over_pushed || stack_size) \
{ \
if (over_pushed > first_interval) \
@@ -469,7 +470,7 @@ compact_neutrals (TypeLink *list)
override = status_stack[stack_size].override; \
} \
} \
- }
+ } while (0)
/*==========================================================================
* There was no support for sor and eor in the absence of Explicit Embedding
@@ -479,7 +480,8 @@ compact_neutrals (TypeLink *list)
/* Return the type of previous char or the sor, if already at the start of
a run level. */
#define PREV_TYPE_OR_SOR(pp) \
- (RL_LEVEL(pp->prev) == RL_LEVEL(pp) ? \
+ ( \
+ RL_LEVEL(pp->prev) == RL_LEVEL(pp) ? \
RL_TYPE(pp->prev) : \
FRIBIDI_LEVEL_TO_DIR(MAX(RL_LEVEL(pp->prev), RL_LEVEL(pp))) \
)
@@ -487,7 +489,8 @@ compact_neutrals (TypeLink *list)
/* Return the type of next char or the eor, if already at the end of
a run level. */
#define NEXT_TYPE_OR_EOR(pp) \
- (!pp->next ? \
+ ( \
+ !pp->next ? \
FRIBIDI_LEVEL_TO_DIR(RL_LEVEL(pp)) : \
(RL_LEVEL(pp->next) == RL_LEVEL(pp) ? \
RL_TYPE(pp->next) : \
diff --git a/fribidi.spec.in b/fribidi.spec.in
index fdfd9d5..ed2a5ea 100644
--- a/fribidi.spec.in
+++ b/fribidi.spec.in
@@ -2,12 +2,12 @@
#
# Everything:
# (this is equivalent to two others together)
-# fribidiN-version-release-arch.rpm
+# @PACKAGE@N-version-release-arch.rpm
# Runtime material: Shared library and command line tool
-# libfribidiN-version-release-arch.rpm
+# lib@PACKAGE@N-version-release-arch.rpm
# Development material: Static library and header files
-# (requires libfribidi)
-# libfribidi-devel-version-release-arch.rpm
+# (requires lib@PACKAGE@)
+# lib@PACKAGE@N-devel-version-release-arch.rpm
# Where N is the major version number.
%define name @PACKAGE@
@@ -24,8 +24,8 @@ Version: %{ver}
Release: %{rel}
Serial: %{apiver}
Copyright: LGPL
-Source: http://prdownloads.sourceforge.net/fribidi/%{name}-%{ver}.tar.gz
-URL: http://fribidi.sourceforge.net/
+Source: http://prdownloads.sourceforge.net/%{name}/%{name}-%{ver}.tar.gz
+URL: http://%{name}.sourceforge.net/
BuildRoot: %{_tmppath}/%{name}
Summary: Library implementing the Unicode Bidirectional Algorithm
Group: System/Libraries
@@ -87,16 +87,16 @@ fi
--mandir=%{_mandir} --infodir=%{_infodir} \
--localstatedir=%{_localstatedir} --sharedstatedir=%{_sharedstatedir}
-make CFLAGS="$RPM_OPT_FLAGS"
+make OPT_CFLAGS="$RPM_OPT_FLAGS"
%install
-rm -rf $RPM_BUILD_ROOT
-mkdir -p $RPM_BUILD_ROOT%{prefix}
+rm -rf "$RPM_BUILD_ROOT"
+mkdir -p "$RPM_BUILD_ROOT%{prefix}"
make DESTDIR="$RPM_BUILD_ROOT" install
%clean
-rm -rf $RPM_BUILD_ROOT
+rm -rf "$RPM_BUILD_ROOT"
%post -n %{name}%{major} -p /sbin/ldconfig
%postun -n %{name}%{major} -p /sbin/ldconfig
@@ -134,5 +134,8 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Sat Jan 26 2002 Behdad Esfahbod <behdad@bamdad.org>
+- CFLAGS changed to OPT_CFLAGS.
+
* Wed Jan 9 2002 Behdad Esfahbod <behdad@bamdad.org>
- First spec released.
diff --git a/fribidi_create_mirroring.c b/fribidi_create_mirroring.c
index 435df29..057046e 100644
--- a/fribidi_create_mirroring.c
+++ b/fribidi_create_mirroring.c
@@ -128,7 +128,7 @@ int
main (int argc, char **argv)
{
char *p;
-
+
p = (argc >= 2) ? argv[1] : "unidata";
bidi_mirroring_file = malloc (50 + strlen (p));
sprintf (bidi_mirroring_file, "%s/BidiMirroring.txt", p);