[Top][All Lists]

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

Re: [RP] patches to make it compile with very old compilers

From: J. R. Mauro
Subject: Re: [RP] patches to make it compile with very old compilers
Date: Fri, 17 Jul 2009 12:16:43 -0400

On Jul 17, 2009, at 11:39, "Bernhard R. Link" <address@hidden> wrote:

Here are two patches to make ratpoison compile with older

The first one fixes an actual bug in putting libraries in library
flags instead of libraries:

Subject: [PATCH] move libraries from LDFLAGS to LDADD to avoid problems in argument order

diff --git a/src/Makefile.am b/src/Makefile.am
index 715c47b..b4ce142 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,7 +22,8 @@
bin_PROGRAMS        = ratpoison
MAINTAINERCLEANFILES = Makefile.in config.h.in


ratpoison_SOURCES    = actions.c        \

I've applied this as "obvious trivial bugfix".

The second patch[1] stops using some c99 features to make it compile with
gcc version 2, which I am very unsure about:

--- a/src/history.c
+++ b/src/history.c
@@ -65,7 +65,7 @@ extract_shell_part (const char *p)

struct history_item {
   struct list_head node;
-    char line[];
+    char line[1];

static struct history {
@@ -155,7 +155,7 @@ history_add_upto (int history_id, const char
*item, size_t max)

  item_len = strlen(item);
-  i = xmalloc (sizeof(struct history_item) + item_len + 1);
+  i = xmalloc (sizeof(struct history_item) + item_len);

  memcpy (i->line, item, item_len + 1);
  list_add_tail (&i->node, &h->head);

- makes it work with some gcc 2.9x compilers.
(I do not know how many, as linkedlist.h also uses enhancements,
so that even with this it is not c89 compatible but at most some
older variants of gnu89).

IIRC the Linux linkedlist includes more portable non-gcc-specific idioms in case of an old GCC. You might try bringing those into the RP linked list.

- we are 10 years after c99
- might confuse any array length checkers (though they might have
 an exception for [1], as that does not make much sense otherwise).

What do you think?

   Bernhard R. Link

[1] written and tested by Ineiev <address@hidden>

Ratpoison-devel mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]