Changeset c8fcf66 in git


Ignore:
Timestamp:
07/03/15 10:08:31 (5 years ago)
Author:
Olly Betts <olly@…>
Branches:
line_contents, master, stereo, travis-osx
Children:
42fd3ef
Parents:
82919e07
Message:

src/avenprcore.cc,src/message.c,src/message.h: msg() has returned a
persistent copy of the message for decades, so the code's bound to
rely on that in some places. And there's no real reason it
shouldn't continue to as the messages are under 20KB of UTF-8 text
for any language, so lazy loading isn't worth the complication. So
remove msgPerm() and the unused msgFree() macro, and document that
msg() returns a persistent copy.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r82919e07 rc8fcf66  
     1Sat Mar 07 10:03:37 GMT 2015  Olly Betts <olly@survex.com>
     2
     3        * src/avenprcore.cc,src/message.c,src/message.h: msg() has returned a
     4          persistent copy of the message for decades, so the code's bound to
     5          rely on that in some places.  And there's no real reason it
     6          shouldn't continue to as the messages are under 20KB of UTF-8 text
     7          for any language, so lazy loading isn't worth the complication.  So
     8          remove msgPerm() and the unused msgFree() macro, and document that
     9          msg() returns a persistent copy.
     10
    111Sat Mar 07 00:01:50 GMT 2015  Olly Betts <olly@survex.com>
    212
  • src/avenprcore.cc

    r82919e07 rc8fcf66  
    167167
    168168    /* note down so we can switch to printer charset */
    169     msg166 = msgPerm(/*Page %d of %d*/166);
     169    msg166 = msg(/*Page %d of %d*/166);
    170170    old_charset = select_charset(CHARSET_ISO_8859_1);
    171171
    172     l->footer = msgPerm(/*Survey “%s”   Page %d (of %d)   Processed on %s*/167);
     172    l->footer = msg(/*Survey “%s”   Page %d (of %d)   Processed on %s*/167);
    173173
    174174    cPagesPrinted = 0;
  • src/message.c

    r82919e07 rc8fcf66  
    11/* message.c
    22 * Fairly general purpose message and error routines
    3  * Copyright (C) 1993-2003,2004,2005,2006,2007,2010,2011,2012,2014 Olly Betts
     3 * Copyright (C) 1993-2003,2004,2005,2006,2007,2010,2011,2012,2014,2015 Olly Betts
    44 *
    55 * This program is free software; you can redistribute it and/or modify
     
    11881188}
    11891189
    1190 /* Message may be overwritten by next call
    1191  * (but not in current implementation) */
    11921190const char *
    11931191msg(int en)
     
    12211219
    12221220   return msg_array[en];
    1223 }
    1224 
    1225 /* returns persistent copy of message */
    1226 const char *
    1227 msgPerm(int en)
    1228 {
    1229    return msg(en);
    12301221}
    12311222
  • src/message.h

    r82919e07 rc8fcf66  
    11/* message.h
    22 * Function prototypes for message.c
    3  * Copyright (C) 1998-2003,2005,2010 Olly Betts
     3 * Copyright (C) 1998-2003,2005,2010,2015 Olly Betts
    44 *
    55 * This program is free software; you can redistribute it and/or modify
     
    5757const char *msg_appname(void);
    5858
    59 /* Message may be overwritten by next call */
     59/* Return the message string corresponding to number en */
    6060const char *msg(int en);
    61 /* Returns persistent copy of message */
    62 const char *msgPerm(int en);
    63 /* Kill persistent copy of message */
    64 #define msgFree(S) (void)0
    6561
    6662void v_report(int severity, const char *fnm, int line, int col, int en, va_list ap);
Note: See TracChangeset for help on using the changeset viewer.