Subject: Re: ... patches

From: Dominik Vogt <[email-masked]>
Date: Wed, 16 Dec 1998 11:37:36 +0100

On Tue, Dec 15, 1998 at 09:02:24PM -0500, [email-masked] wrote:
> This patch is more difficult because I stripped the TABs out of
> FvwmButtons.c (nasty things and no-one can ever agree how many spaces
> they should represent). I shall list my significant changes instead:

Please, no reformatting now. CVS is a bit picky about whitespace
changes and we don't want to have thousands of TAB diffs so close
to the release. When I apply the patche I will tabify it again.
BTW, we have an (unwritten) agreement that a TAB is 8 spaces.
After 2.2 I want to make a stab at reindenting the code anyway.

And one thing about your patches: Please compress them with
gzip, not bzip2. I don't know how many people even know that
compressing tool. I've tried it once, but since it saved no
more than 10% (compared to gzip) but took at least twice as
long, so I threw it away.

Bye

Dominik
-- 
Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/14-4596, fax: 07031/14-3883, [email-masked]
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].

---

From: [email-masked]
Date: Tue, 15 Dec 1998 21:02:24 -0500

Hi,

FvwmButtons.c >>>>>>>>>>>>>>>

#include <setjmp.h>

...

#ifdef __GNUC__
#  define _GNU_ATTR_NORETURN_  __attribute__((noreturn))
#else
#  define _GNU_ATTR_NORETURN_
#endif

...

void DeadPipe(int) _GNU_ATTR_NORETURN_
static void DeadPipeCleanup(void);
static void DeadPipeHandler(int sig);
...
static void nocolor(const char *a, const char *b) _GNU_ATTR_NORETURN_;
...

static sigjmp_buf  deadjump;

...

/*
** DeadPipe()
** Externally callable function to quit!
void DeadPipe(int nonsense)
{
  exit(1);
}

/*
** DeadPipeHandler()
** Signal handler that will make the event loop terminate
*/
static void DeadPipeHandler(int sig)
{
  siglongjmp(deadjump,1);
}

/*
** DeadPipeCleanup()
** Remove all the windows from the Button-Bar, and close them as
necessary.
** Note that this is an exit-procedure and so will be called
automatically
*/
static void DeadPipeCleanup(void)
{
 ... original cleanup code , except it doesn't call exit()
}

...

static XErrorHandler oldErrorHandler=NULL;
int myErrorHandler(Display *dpy, XErrorEvent *event)
{
  /* fprintf( ... etc */
  /* Don't call the default handler - it kills the button-bar.
   * We want to give the button-bar a chance to respawn its dead button
   */
  /* return (*oldErrorHandler)(dpy,event); */
  return 0;
}

int main( ...
{
  char *s;
...

  MyName = argv[0];
  s = strrchr(MyName,'/');
  if (s) MyName = s+1;

 - No need to allocate storage for the module name; just assign MyName
in a more cunning way.
...

  /*
  ** Now that we have finished initialising everything,
  ** it is safe(r) to install the clean-up handlers ...
  */
  atexit(DeadPipeCleanup);
  if ( !sigsetjmp(deadjump,1) )
  {
    struct sigaction  sigact;

    /* Do NOT install the signal handlers until the long-jump
     * has been safely initialised ...
     */
    sigemptyset(&sigact.sa_mask);
    sigact.sa_flags = 0;
    sigact.sa_handler = DeadPipeHandler;

    sigaction(SIGPIPE,&sigact,NULL);
    sigaction(SIGINT,&sigact,NULL);
    sigaction(SIGHUP,&sigact,NULL);
    sigaction(SIGQUIT,&sigact,NULL);
    sigaction(SIGTERM,&sigact,NULL);

    Loop();
  }
  /**/
  return 0;
}

The attachment contains the rest of the changes - mostly fixes for
compiler warnings.

Cheers,
Chris