Changeset fc625fb


Ignore:
Timestamp:
Jun 22, 2011, 3:45:52 PM (13 years ago)
Author:
GitHub Merge Button <merge-button@github.com>
Parents:
b343c2c (diff), 6376af1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:
Merge 6376af1d0990d3324261fd650a8d36af1195eacf into b343c2c1248ccfcd8b514c26f4c896c1ec41888b
Files:
2 deleted
46 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    rb343c2c rfc625fb  
    31563156    }
    31573157   
    3158     /* if it exited, fork & exec a new one */
     3158    /* if it exited, spawn a new one */
    31593159    if (owl_global_get_newmsgproc_pid(&g)==0) {
    3160       pid_t i;
    31613160      int myargc;
    3162       i=fork();
    3163       if (i) {
    3164         /* parent set the child's pid */
    3165         owl_global_set_newmsgproc_pid(&g, i);
    3166         owl_function_debugmsg("I'm the parent and I started a new newmsgproc with pid %i", i);
    3167       } else {
    3168         /* child exec's the program */
    3169         char **parsed;
    3170         parsed=owl_parseline(owl_global_get_newmsgproc(&g), &myargc);
    3171         if (myargc < 0) {
    3172           owl_function_debugmsg("Could not parse newmsgproc '%s': unbalanced quotes?", owl_global_get_newmsgproc(&g));
    3173         }
    3174         if (myargc <= 0) {
    3175           _exit(127);
    3176         }
    3177         owl_function_debugmsg("About to exec \"%s\" with %d arguments", parsed[0], myargc);
    3178        
    3179         execvp(parsed[0], parsed);
    3180        
    3181        
    3182         /* was there an error exec'ing? */
    3183         owl_function_debugmsg("Cannot run newmsgproc '%s': cannot exec '%s': %s",
    3184                               owl_global_get_newmsgproc(&g), parsed[0], strerror(errno));
    3185         _exit(127);
     3161      char **argv = owl_parseline(owl_global_get_newmsgproc(&g), &myargc);
     3162      if (myargc < 0) {
     3163        owl_function_debugmsg("Could not parse newmsgproc '%s': unbalanced quotes?",
     3164                              owl_global_get_newmsgproc(&g));
     3165      } else if (myargc > 0) {
     3166        /* Spawn the child. */
     3167        pid_t pid;
     3168        GError *error = NULL;
     3169        owl_function_debugmsg("About to exec \"%s\" with %d arguments", argv[0], myargc);
     3170        if (g_spawn_async(NULL, argv, NULL,
     3171                          G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
     3172                          NULL, NULL, &pid, &error)) {
     3173          owl_global_set_newmsgproc_pid(&g, pid);
     3174          owl_function_debugmsg("I'm the parent and I started a new newmsgproc with pid %i", pid);
     3175        } else {
     3176          owl_function_debugmsg("Cannot run newmsgproc '%s': %s",
     3177                                owl_global_get_newmsgproc(&g), error->message);
     3178          g_error_free(error);
     3179        }
    31863180      }
     3181      g_strfreev(argv);
    31873182    }
    31883183  }
  • Makefile.am

    r3535a6e r4f746f8  
    4545     aim.c buddy.c buddylist.c style.c errqueue.c \
    4646     zbuddylist.c popexec.c select.c wcwidth.c \
    47      glib_compat.c mainpanel.c msgwin.c sepbar.c editcontext.c signal.c
     47     mainpanel.c msgwin.c sepbar.c editcontext.c signal.c
    4848
    4949NORMAL_SRCS = filterproc.c window.c windowcb.c
  • README

    r13ee8f2 r9179fd7  
    1919
    2020AnyEvent
     21Glib
    2122PAR
    2223Net::DNS
  • aim.c

    rdc1edbd rd427f08  
    113113}
    114114
    115 void owl_aim_send_nop(owl_timer *t, void *data) {
    116     if(owl_global_is_doaimevents(&g)) {
    117         aim_session_t *sess = owl_global_get_aimsess(&g);
    118         aim_flap_nop(sess, aim_getconn_type(sess, AIM_CONN_TYPE_BOS));
    119     }
     115gboolean owl_aim_send_nop(gpointer data) {
     116  owl_global *g = data;
     117  if (owl_global_is_doaimevents(g)) {
     118    aim_session_t *sess = owl_global_get_aimsess(g);
     119    aim_flap_nop(sess, aim_getconn_type(sess, AIM_CONN_TYPE_BOS));
     120  }
     121  return TRUE;
    120122}
    121123
     
    183185  owl_function_debugmsg("owl_aim_login: connecting");
    184186
    185   g.aim_nop_timer = owl_select_add_timer("owl_aim_send_nop", 30, 30, owl_aim_send_nop, NULL, NULL);
     187  g.aim_nop_timer = g_timeout_add_seconds(30, owl_aim_send_nop, &g);
    186188
    187189  return(0);
    188190}
    189191
    190 static void owl_aim_unset_ignorelogin(owl_timer *t, void *data)
    191 {
    192     owl_global_unset_ignore_aimlogin(&g);
     192static gboolean owl_aim_unset_ignorelogin(void *data)
     193{
     194  owl_global *g = data;
     195  owl_global_unset_ignore_aimlogin(g);
     196  return FALSE;  /* only run once. */
    193197}
    194198
     
    209213  /* start the ingorelogin timer */
    210214  owl_global_set_ignore_aimlogin(&g);
    211   owl_select_add_timer("owl_aim_unset_ignorelogin",
    212                        owl_global_get_aim_ignorelogin_timer(&g),
    213                        0, owl_aim_unset_ignorelogin, NULL, NULL);
     215  g_timeout_add_seconds(owl_global_get_aim_ignorelogin_timer(&g),
     216                        owl_aim_unset_ignorelogin, &g);
    214217
    215218  /* aim_ssi_setpresence(owl_global_get_aimsess(&g), 0x00000400); */
     
    225228  owl_global_set_aimnologgedin(&g);
    226229  owl_global_set_no_doaimevents(&g);
    227   owl_select_remove_timer(g.aim_nop_timer);
     230  if (g.aim_nop_timer) {
     231    g_source_remove(g.aim_nop_timer);
     232    g.aim_nop_timer = 0;
     233  }
    228234}
    229235
     
    244250  owl_global_set_aimnologgedin(&g);
    245251  owl_global_set_no_doaimevents(&g);
    246   owl_select_remove_timer(g.aim_nop_timer);
     252  if (g.aim_nop_timer) {
     253    g_source_remove(g.aim_nop_timer);
     254    g.aim_nop_timer = 0;
     255  }
    247256}
    248257
     
    428437
    429438/* caller must free the return */
    430 char *owl_aim_normalize_screenname(const char *in)
     439G_GNUC_WARN_UNUSED_RESULT char *owl_aim_normalize_screenname(const char *in)
    431440{
    432441  char *out;
  • barnowl

    rde18326 rb14f8cb  
    77EXE="$0.bin"
    88
    9 if ! test -x "$EXE"; then
     9if test ! -x "$EXE"; then
    1010    echo "Cannot find barnowl.bin" >&2
    1111    exit 1
    1212fi
    1313
    14 export BARNOWL_DATA_DIR="$SRCDIR/perl/"
    15 export BARNOWL_BIN_DIR="$SRCDIR/"
     14BARNOWL_DATA_DIR="$SRCDIR/perl/"
     15BARNOWL_BIN_DIR="$SRCDIR/"
     16export BARNOWL_DATA_DIR
     17export BARNOWL_BIN_DIR
    1618exec "$EXE" "$@"
  • cmd.c

    r4c7c21f rd427f08  
    55#include "owl.h"
    66
    7 extern const owl_cmd commands_to_init[];
    8 
    97/**************************************************************************/
    108/***************************** COMMAND DICT *******************************/
    119/**************************************************************************/
    1210
    13 int owl_cmddict_setup(owl_cmddict *cd) {
     11void owl_cmddict_setup(owl_cmddict *cd)
     12{
    1413  owl_cmddict_init(cd);
    15   if (0 != owl_cmddict_add_from_list(cd, commands_to_init)) return(-1);
    16   return(0);
     14  owl_cmd_add_defaults(cd);
    1715}
    1816
     
    2220
    2321/* for bulk initialization at startup */
    24 int owl_cmddict_add_from_list(owl_cmddict *cd, const owl_cmd *cmds) {
     22void owl_cmddict_add_from_list(owl_cmddict *cd, const owl_cmd *cmds)
     23{
    2524  const owl_cmd *cur;
    26   int ret = 0;
    2725  for (cur = cmds; cur->name != NULL; cur++) {
    28     ret = owl_cmddict_add_cmd(cd, cur);
    29     if (ret < 0) break;
    30   }
    31   return ret;
     26    owl_cmddict_add_cmd(cd, cur);
     27  }
    3228}
    3329
     
    4137
    4238/* creates a new command alias */
    43 int owl_cmddict_add_alias(owl_cmddict *cd, const char *alias_from, const char *alias_to) {
     39void owl_cmddict_add_alias(owl_cmddict *cd, const char *alias_from, const char *alias_to) {
    4440  owl_cmd *cmd;
    4541  cmd = g_new(owl_cmd, 1);
     
    4743  owl_perlconfig_new_command(cmd->name);
    4844  owl_dict_insert_element(cd, cmd->name, cmd, (void (*)(void *))owl_cmd_delete);
    49   return(0);
    5045}
    5146
     
    6055}
    6156
    62 char *_owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc, const char *buff) {
     57/* caller must free the return */
     58G_GNUC_WARN_UNUSED_RESULT char *_owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc, const char *buff)
     59{
    6360  char *retval = NULL;
    6461  const owl_cmd *cmd;
     
    7572}
    7673
    77 char *owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *cmdbuff) {
     74/* caller must free the return */
     75G_GNUC_WARN_UNUSED_RESULT char *owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *cmdbuff)
     76{
    7877  char **argv;
    7978  int argc;
     
    9796}
    9897
    99 char *owl_cmddict_execute_argv(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc) {
     98/* caller must free the return */
     99G_GNUC_WARN_UNUSED_RESULT char *owl_cmddict_execute_argv(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc)
     100{
    100101  char *buff;
    101102  char *retval = NULL;
     
    124125}
    125126
    126 int owl_cmd_create_alias(owl_cmd *cmd, const char *name, const char *aliased_to) {
     127void owl_cmd_create_alias(owl_cmd *cmd, const char *name, const char *aliased_to) {
    127128  memset(cmd, 0, sizeof(owl_cmd));
    128129  cmd->name = g_strdup(name);
    129130  cmd->cmd_aliased_to = g_strdup(aliased_to);
    130131  cmd->summary = g_strdup_printf("%s%s", OWL_CMD_ALIAS_SUMMARY_PREFIX, aliased_to);
    131   return(0);
    132132}
    133133
     
    153153}
    154154
    155 char *owl_cmd_execute(const owl_cmd *cmd, const owl_cmddict *cd, const owl_context *ctx, int argc, const char *const *argv, const char *cmdbuff) {
     155/* caller must free the result */
     156G_GNUC_WARN_UNUSED_RESULT char *owl_cmd_execute(const owl_cmd *cmd, const owl_cmddict *cd, const owl_context *ctx, int argc, const char *const *argv, const char *cmdbuff)
     157{
    156158  static int alias_recurse_depth = 0;
    157159  int ival=0;
     
    226228
    227229/* returns a summary line describing this keymap.  the caller must free. */
    228 char *owl_cmd_describe(const owl_cmd *cmd) {
     230G_GNUC_WARN_UNUSED_RESULT char *owl_cmd_describe(const owl_cmd *cmd)
     231{
    229232  if (!cmd || !cmd->name || !cmd->summary) return NULL;
    230233  return g_strdup_printf("%-25s - %s", cmd->name, cmd->summary);
  • commands.c

    r697221f rd427f08  
    88/* fn is "char *foo(int argc, const char *const *argv, const char *buff)" */
    99#define OWLCMD_ARGS(name, fn, ctx, summary, usage, description) \
    10         { name, summary, usage, description, ctx, \
     10        { g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \
    1111          NULL, fn, NULL, NULL, NULL, NULL, NULL, NULL }
    1212
    1313/* fn is "void foo(void)" */
    1414#define OWLCMD_VOID(name, fn, ctx, summary, usage, description) \
    15         { name, summary, usage, description, ctx, \
     15        { g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \
    1616          NULL, NULL, fn, NULL, NULL, NULL, NULL, NULL }
    1717
    1818/* fn is "void foo(int)" */
    1919#define OWLCMD_INT(name, fn, ctx, summary, usage, description) \
    20         { name, summary, usage, description, ctx, \
     20        { g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \
    2121          NULL, NULL, NULL, fn, NULL, NULL, NULL, NULL }
    2222
    2323#define OWLCMD_ALIAS(name, actualname) \
    24         { name, OWL_CMD_ALIAS_SUMMARY_PREFIX actualname, "", "", OWL_CTX_ANY, \
    25           actualname, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
     24        { g_strdup(name), g_strdup(OWL_CMD_ALIAS_SUMMARY_PREFIX actualname), g_strdup(""), g_strdup(""), OWL_CTX_ANY, \
     25          g_strdup(actualname), NULL, NULL, NULL, NULL, NULL, NULL, NULL }
    2626
    2727/* fn is "char *foo(void *ctx, int argc, const char *const *argv, const char *buff)" */
    2828#define OWLCMD_ARGS_CTX(name, fn, ctx, summary, usage, description) \
    29         { name, summary, usage, description, ctx, \
     29        { g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \
    3030          NULL, NULL, NULL, NULL, ((char*(*)(void*,int,const char*const *,const char*))fn), NULL, NULL, NULL }
    3131
    3232/* fn is "void foo(void)" */
    3333#define OWLCMD_VOID_CTX(name, fn, ctx, summary, usage, description) \
    34         { name, summary, usage, description, ctx, \
     34        { g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \
    3535          NULL, NULL, NULL, NULL, NULL, ((void(*)(void*))(fn)), NULL, NULL }
    3636
    3737/* fn is "void foo(int)" */
    3838#define OWLCMD_INT_CTX(name, fn, ctx, summary, usage, description) \
    39         { name, summary, usage, description, ctx, \
     39        { g_strdup(name), g_strdup(summary), g_strdup(usage), g_strdup(description), ctx, \
    4040          NULL, NULL, NULL, NULL, NULL, NULL, ((void(*)(void*,int))fn), NULL }
    4141
    4242
    43 const owl_cmd commands_to_init[]
    44   = {
     43void owl_cmd_add_defaults(owl_cmddict *cd)
     44{
     45  owl_cmd commands_to_init[] = {
     46
    4547  OWLCMD_ARGS("zlog", owl_command_zlog, OWL_CTX_ANY,
    4648              "send a login or logout notification",
     
    654656              "show subscriptions / show subs\n"
    655657              "show terminal\n"
    656               "show timers\n"
    657658              "show variables\n"
    658659              "show variable <variable>\n"
     
    10371038  { NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
    10381039
    1039 };
     1040  };
     1041
     1042  owl_cmddict_add_from_list(cd, commands_to_init);
     1043  owl_cmd *cmd;
     1044  for (cmd = commands_to_init; cmd->name != NULL; cmd++)
     1045    owl_cmd_cleanup(cmd);
     1046}
    10401047
    10411048void owl_command_info(void)
     
    13661373}
    13671374
    1368 char *owl_command_smartfilter(int argc, const char *const *argv, const char *buff)
     1375G_GNUC_WARN_UNUSED_RESULT char *owl_command_smartfilter(int argc, const char *const *argv, const char *buff)
    13691376{
    13701377  char *filtname = NULL;
     
    14061413}
    14071414
    1408 char *owl_command_get_shift(int argc, const char *const *argv, const char *buff)
     1415G_GNUC_WARN_UNUSED_RESULT char *owl_command_get_shift(int argc, const char *const *argv, const char *buff)
    14091416{
    14101417  if(argc != 1)
     
    16371644
    16381645
    1639 char *owl_command_exec(int argc, const char *const *argv, const char *buff)
     1646G_GNUC_WARN_UNUSED_RESULT char *owl_command_exec(int argc, const char *const *argv, const char *buff)
    16401647{
    16411648  return owl_function_exec(argc, argv, buff, OWL_OUTPUT_RETURN);
    16421649}
    16431650
    1644 char *owl_command_pexec(int argc, const char *const *argv, const char *buff)
     1651G_GNUC_WARN_UNUSED_RESULT char *owl_command_pexec(int argc, const char *const *argv, const char *buff)
    16451652{
    16461653  return owl_function_exec(argc, argv, buff, OWL_OUTPUT_POPUP);
    16471654}
    16481655
    1649 char *owl_command_aexec(int argc, const char *const *argv, const char *buff)
     1656G_GNUC_WARN_UNUSED_RESULT char *owl_command_aexec(int argc, const char *const *argv, const char *buff)
    16501657{
    16511658  return owl_function_exec(argc, argv, buff, OWL_OUTPUT_ADMINMSG);
    16521659}
    16531660
    1654 char *owl_command_perl(int argc, const char *const *argv, const char *buff)
     1661G_GNUC_WARN_UNUSED_RESULT char *owl_command_perl(int argc, const char *const *argv, const char *buff)
    16551662{
    16561663  return owl_function_perl(argc, argv, buff, OWL_OUTPUT_RETURN);
    16571664}
    16581665
    1659 char *owl_command_pperl(int argc, const char *const *argv, const char *buff)
     1666G_GNUC_WARN_UNUSED_RESULT char *owl_command_pperl(int argc, const char *const *argv, const char *buff)
    16601667{
    16611668  return owl_function_perl(argc, argv, buff, OWL_OUTPUT_POPUP);
    16621669}
    16631670
    1664 char *owl_command_aperl(int argc, const char *const *argv, const char *buff)
     1671G_GNUC_WARN_UNUSED_RESULT char *owl_command_aperl(int argc, const char *const *argv, const char *buff)
    16651672{
    16661673  return owl_function_perl(argc, argv, buff, OWL_OUTPUT_ADMINMSG);
    16671674}
    16681675
    1669 char *owl_command_multi(int argc, const char *const *argv, const char *buff)
     1676G_GNUC_WARN_UNUSED_RESULT char *owl_command_multi(int argc, const char *const *argv, const char *buff)
    16701677{
    16711678  char *lastrv = NULL, *newbuff;
     
    22252232  } else if (!strcmp(argv[1], "styles")) {
    22262233    owl_function_show_styles();
    2227   } else if (!strcmp(argv[1], "timers")) {
    2228     owl_function_show_timers();
    22292234  } else if (!strcmp(argv[1], "subs") || !strcmp(argv[1], "subscriptions")) {
    22302235    owl_function_getsubs();
     
    25892594}
    25902595
    2591 char *owl_command_getstyle(int argc, const char *const *argv, const char *buff)
     2596G_GNUC_WARN_UNUSED_RESULT char *owl_command_getstyle(int argc, const char *const *argv, const char *buff)
    25922597{
    25932598  const char *stylename;
     
    26332638}
    26342639
    2635 char *owl_command_with_history(int argc, const char *const *argv, const char *buff)
     2640G_GNUC_WARN_UNUSED_RESULT char *owl_command_with_history(int argc, const char *const *argv, const char *buff)
    26362641{
    26372642  owl_history *hist;
  • configure.ac

    rf97c1a6 r4f746f8  
    88
    99AC_PROG_CC
     10AC_PROG_CC_C99
    1011
    1112AC_ARG_WITH([stack-protector],
     
    8081AC_HEADER_STDC
    8182AC_HEADER_SYS_WAIT
    82 AC_HEADER_STDBOOL
    83 AC_CHECK_HEADERS(strings.h sys/ioctl.h sys/filio.h unistd.h)
     83AC_CHECK_HEADERS(stdbool.h strings.h sys/ioctl.h sys/filio.h unistd.h)
    8484
    8585dnl Add CFLAGS for embeded perl
     
    115115
    116116dnl Add CFLAGS and LIBS for glib-2.0
    117 PKG_CHECK_MODULES(GLIB,[glib-2.0 >= 2.12 gobject-2.0 gthread-2.0])
     117PKG_CHECK_MODULES(GLIB,[glib-2.0 >= 2.16 gobject-2.0 gthread-2.0])
    118118
    119119AC_MSG_NOTICE([Adding glib-2.0 CFLAGS ${GLIB_CFLAGS}])
     
    130130AX_CFLAGS_WARN_ALL([AM_CFLAGS])
    131131AX_C_CHECK_FLAG([-Wstrict-prototypes],[],[],[AM_CFLAGS="$AM_CFLAGS -Wstrict-prototypes"])
     132AX_C_CHECK_FLAG([-Wwrite-strings],[],[],[AM_CFLAGS="$AM_CFLAGS -Wwrite-strings"])
    132133
    133134dnl Shut gcc up about zero-length format strings; the warning's apparently for
     
    143144                                 test "$HAVE_DES_ECB_ENCRYPT"])
    144145
    145 AM_CFLAGS="$AM_CFLAGS -D_XOPEN_SOURCE=500"
     146AM_CFLAGS="$AM_CFLAGS -D_XOPEN_SOURCE=600"
    146147dnl Define _BSD_SOURCE because zephyr needs caddr_t.
    147148AM_CFLAGS="$AM_CFLAGS -D_BSD_SOURCE"
  • context.c

    rd4927a7 rd427f08  
    66
    77/* TODO: dependency from owl_context -> owl_window is annoying. */
    8 owl_context *owl_context_new(int mode, void *data, const char *keymap, owl_window *cursor)
     8G_GNUC_WARN_UNUSED_RESULT owl_context *owl_context_new(int mode, void *data, const char *keymap, owl_window *cursor)
    99{
    1010  owl_context *c;
  • dict.c

    r4c7c21f rd427f08  
    107107/* Doesn't free the value of the element, but does
    108108 * return it so the caller can free it. */
    109 void *owl_dict_remove_element(owl_dict *d, const char *k) {
     109G_GNUC_WARN_UNUSED_RESULT void *owl_dict_remove_element(owl_dict *d, const char *k)
     110{
    110111  int i;
    111112  int pos, found;
  • editcontext.c

    r4a41f16 rd427f08  
    88}
    99
    10 owl_context *owl_editcontext_new(int mode, owl_editwin *e, const char *keymap, void (*deactivate_cb)(owl_context*), void *cbdata)
     10G_GNUC_WARN_UNUSED_RESULT owl_context *owl_editcontext_new(int mode, owl_editwin *e, const char *keymap, void (*deactivate_cb)(owl_context*), void *cbdata)
    1111{
    1212  owl_context *ctx = owl_context_new(mode, owl_editwin_ref(e), keymap,
  • editwin.c

    r3b8a563 rd427f08  
    6161static const char *oe_copy_buf(owl_editwin *e, const char *buf, int len);
    6262static int oe_copy_region(owl_editwin *e);
    63 static char *oe_chunk(owl_editwin *e, int start, int end);
     63static G_GNUC_WARN_UNUSED_RESULT char *oe_chunk(owl_editwin *e, int start, int end);
    6464static void oe_destroy_cbdata(owl_editwin *e);
    6565static void oe_dirty(owl_editwin *e);
     
    7070#define WHITESPACE " \n\t"
    7171
    72 static owl_editwin *owl_editwin_allocate(void)
     72static G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_editwin_allocate(void)
    7373{
    7474  owl_editwin *e = g_new0(owl_editwin, 1);
     
    142142}
    143143
    144 owl_editwin *owl_editwin_new(owl_window *win, int winlines, int wincols, int style, owl_history *hist)
     144G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_editwin_new(owl_window *win, int winlines, int wincols, int style, owl_history *hist)
    145145{
    146146  owl_editwin *e = owl_editwin_allocate();
     
    13691369}
    13701370
    1371 char *owl_editwin_get_region(owl_editwin *e)
     1371G_GNUC_WARN_UNUSED_RESULT char *owl_editwin_get_region(owl_editwin *e)
    13721372{
    13731373  int start, end;
     
    13881388}
    13891389
    1390 static char *oe_chunk(owl_editwin *e, int start, int end)
     1390static G_GNUC_WARN_UNUSED_RESULT char *oe_chunk(owl_editwin *e, int start, int end)
    13911391{
    13921392  char *p;
  • filter.c

    re56303f rd427f08  
    200200
    201201
    202 char* owl_filter_print(const owl_filter *f)
     202char G_GNUC_WARN_UNUSED_RESULT *owl_filter_print(const owl_filter *f)
    203203{
    204204  GString *out = g_string_new("");
  • fmtext.c

    r7b4f3be rd427f08  
    171171 * freeing the return
    172172 */
    173 char *owl_fmtext_print_plain(const owl_fmtext *f)
     173char G_GNUC_WARN_UNUSED_RESULT *owl_fmtext_print_plain(const owl_fmtext *f)
    174174{
    175175  return owl_strip_format_chars(f->buff->str);
  • global.c

    rf97c1a6 rd427f08  
    105105
    106106  owl_message_init_fmtext_cache();
    107   owl_list_create(&(g->io_dispatch_list));
    108   g->timerlist = NULL;
    109107  g->kill_buffer = NULL;
    110108
     
    175173/* Pops the current context from the context stack and returns it. Caller is
    176174 * responsible for freeing. */
    177 owl_context *owl_global_pop_context_no_delete(owl_global *g) {
     175G_GNUC_WARN_UNUSED_RESULT owl_context *owl_global_pop_context_no_delete(owl_global *g)
     176{
    178177  owl_context *c;
    179178  if (!g->context_stack)
     
    727726 * necessary.
    728727 */
    729 owl_message *owl_global_messagequeue_popmsg(owl_global *g)
     728owl_message G_GNUC_WARN_UNUSED_RESULT *owl_global_messagequeue_popmsg(owl_global *g)
    730729{
    731730  owl_message *out;
     
    839838{
    840839  return(&(g->startup_tio));
    841 }
    842 
    843 owl_list *owl_global_get_io_dispatch_list(owl_global *g)
    844 {
    845   return &(g->io_dispatch_list);
    846 }
    847 
    848 GList **owl_global_get_timerlist(owl_global *g)
    849 {
    850   return &(g->timerlist);
    851840}
    852841
  • keybinding.c

    r3b8a563 rd427f08  
    1414
    1515/* sets up a new keybinding for a command */
    16 owl_keybinding *owl_keybinding_new(const char *keyseq, const char *command, void (*function_fn)(void), const char *desc)
     16G_GNUC_WARN_UNUSED_RESULT owl_keybinding *owl_keybinding_new(const char *keyseq, const char *command, void (*function_fn)(void), const char *desc)
    1717{
    1818  owl_keybinding *kb = g_new(owl_keybinding, 1);
     
    8585}
    8686
    87 char *owl_keybinding_stack_tostring(int *j, int len)
     87G_GNUC_WARN_UNUSED_RESULT char *owl_keybinding_stack_tostring(int *j, int len)
    8888{
    8989  GString *string;
     
    100100}
    101101
    102 char *owl_keybinding_tostring(const owl_keybinding *kb)
     102G_GNUC_WARN_UNUSED_RESULT char *owl_keybinding_tostring(const owl_keybinding *kb)
    103103{
    104104  return owl_keybinding_stack_tostring(kb->keys, kb->len);
  • keymap.c

    r4c7c21f rd427f08  
    5151    }
    5252  }
    53   return owl_list_append_element(&km->bindings, kb); 
    54 
     53  owl_list_append_element(&km->bindings, kb);
     54  return 0;
    5555}
    5656
     
    8080
    8181/* returns a summary line describing this keymap.  the caller must free. */
    82 char *owl_keymap_summary(const owl_keymap *km)
     82G_GNUC_WARN_UNUSED_RESULT char *owl_keymap_summary(const owl_keymap *km)
    8383{
    8484  if (!km || !km->name || !km->desc) return NULL;
  • keypress.c

    rd07af84 rd427f08  
    129129/* OWL_META is definied in owl.h */
    130130
    131 char *owl_keypress_tostring(int j, int esc)
     131char G_GNUC_WARN_UNUSED_RESULT *owl_keypress_tostring(int j, int esc)
    132132{
    133133  GString *kb;
  • libfaim/aim.h

    r63de71c rfe73d0c  
    1818
    1919#include "config.h"
    20 #ifdef HAVE_STDBOOL_H
    2120#include <stdbool.h>
    22 #else
    23 #ifndef HAVE__BOOL
    24 #define _Bool signed char
    25 #endif
    26 #define bool _Bool
    27 #define false 0
    28 #define true 1
    29 #define __bool_true_false_are_defined 1
    30 #endif  /* HAVE_STDBOOL_H */
    3121
    3222#include <stdio.h>
  • list.c

    rfda61d3 rd427f08  
    5353}
    5454
    55 int owl_list_append_element(owl_list *l, void *element)
     55void owl_list_append_element(owl_list *l, void *element)
    5656{
    57   return owl_list_insert_element(l, l->size, element);
     57  owl_list_insert_element(l, l->size, element);
    5858}
    5959
    60 int owl_list_prepend_element(owl_list *l, void *element)
     60void owl_list_prepend_element(owl_list *l, void *element)
    6161{
    62   return owl_list_insert_element(l, 0, element);
     62  owl_list_insert_element(l, 0, element);
    6363}
    6464
  • logging.c

    rcc305b5 rd427f08  
    8080}
    8181
    82 char *owl_log_zephyr(const owl_message *m) {
     82G_GNUC_WARN_UNUSED_RESULT char *owl_log_zephyr(const owl_message *m)
     83{
    8384    char *tmp = NULL;
    8485    GString *buffer = NULL;
     
    103104}
    104105
    105 char *owl_log_aim(const owl_message *m) {
     106G_GNUC_WARN_UNUSED_RESULT char *owl_log_aim(const owl_message *m)
     107{
    106108    GString *buffer = NULL;
    107109    buffer = g_string_new("");
     
    120122}
    121123
    122 char *owl_log_jabber(const owl_message *m) {
     124G_GNUC_WARN_UNUSED_RESULT char *owl_log_jabber(const owl_message *m)
     125{
    123126    GString *buffer = NULL;
    124127    buffer = g_string_new("");
     
    132135}
    133136
    134 char *owl_log_generic(const owl_message *m) {
     137G_GNUC_WARN_UNUSED_RESULT char *owl_log_generic(const owl_message *m)
     138{
    135139    GString *buffer;
    136140    buffer = g_string_new("");
  • message.c

    r259e60a8 rd427f08  
    580580
    581581/* caller must free return value. */
    582 char *owl_message_get_cc(const owl_message *m)
     582G_GNUC_WARN_UNUSED_RESULT char *owl_message_get_cc(const owl_message *m)
    583583{
    584584  const char *cur;
     
    597597
    598598/* caller must free return value */
    599 GList *owl_message_get_cc_without_recipient(const owl_message *m)
     599G_GNUC_WARN_UNUSED_RESULT GList *owl_message_get_cc_without_recipient(const owl_message *m)
    600600{
    601601  char *cc, *shortuser, *recip;
  • messagelist.c

    r66a8cd6 rd427f08  
    4242}
    4343
    44 int owl_messagelist_append_element(owl_messagelist *ml, void *element)
     44void owl_messagelist_append_element(owl_messagelist *ml, void *element)
    4545{
    46   return(owl_list_append_element(&(ml->list), element));
     46  owl_list_append_element(&ml->list, element);
    4747}
    4848
  • owl.c

    rcc305b5 r2244836  
    302302}
    303303
    304 void owl_process_input(const owl_io_dispatch *d, void *data)
     304gboolean owl_process_input(GIOChannel *source, GIOCondition condition, void *data)
    305305{
     306  owl_global *g = data;
    306307  owl_input j;
    307308
    308309  while (1) {
    309     j.ch = wgetch(g.input_pad);
    310     if (j.ch == ERR) return;
     310    j.ch = wgetch(g->input_pad);
     311    if (j.ch == ERR) return TRUE;
    311312
    312313    j.uch = '\0';
     
    330331     
    331332      for (i = 1; i < bytes; i++) {
    332         int tmp = wgetch(g.input_pad);
     333        int tmp = wgetch(g->input_pad);
    333334        /* If what we got was not a byte, or not a continuation byte */
    334335        if (tmp > 0xff || !(tmp & 0x80 && ~tmp & 0x40)) {
     
    357358    owl_process_input_char(j);
    358359  }
     360  return TRUE;
    359361}
    360362
     
    448450
    449451/* Sends stderr (read from rfd) messages to the error console */
    450 void stderr_redirect_handler(const owl_io_dispatch *d, void *data)
     452gboolean stderr_redirect_handler(GIOChannel *source, GIOCondition condition, void *data)
    451453{
    452454  int navail, bread;
    453455  char buf[4096];
    454   int rfd = d->fd;
     456  int rfd = g_io_channel_unix_get_fd(source);
    455457  char *err;
    456458
    457   if (rfd<0) return;
     459  /* TODO: Use g_io_channel_read_line? We'd have to be careful about
     460   * blocking on the read. */
     461
     462  if (rfd<0) return TRUE;
    458463  if (-1 == ioctl(rfd, FIONREAD, &navail)) {
    459     return;
     464    return TRUE;
    460465  }
    461466  /*owl_function_debugmsg("stderr_redirect: navail = %d\n", navail);*/
    462   if (navail <= 0) return;
     467  if (navail <= 0) return TRUE;
    463468  if (navail > sizeof(buf)-1) {
    464469    navail = sizeof(buf)-1;
     
    466471  bread = read(rfd, buf, navail);
    467472  if (bread == -1)
    468     return;
     473    return TRUE;
    469474
    470475  err = g_strdup_printf("[stderr]\n%.*s", bread, buf);
     
    472477  owl_function_log_err(err);
    473478  g_free(err);
     479  return TRUE;
    474480}
    475481
     
    485491  owl_options opts;
    486492  GSource *source;
    487 
    488   if (!GLIB_CHECK_VERSION (2, 12, 0))
    489     g_error ("GLib version 2.12.0 or above is needed.");
     493  GIOChannel *channel;
    490494
    491495  argc_copy = argc;
     
    513517
    514518  /* register STDIN dispatch; throw away return, we won't need it */
    515   owl_select_add_io_dispatch(STDIN_FILENO, OWL_IO_READ, &owl_process_input, NULL, NULL);
     519  channel = g_io_channel_unix_new(STDIN_FILENO);
     520  g_io_add_watch(channel, G_IO_IN | G_IO_HUP | G_IO_ERR, &owl_process_input, &g);
     521  g_io_channel_unref(channel);
    516522  owl_zephyr_initialize();
    517523
     
    519525  /* Do this only after we've started curses up... */
    520526  owl_function_debugmsg("startup: doing stderr redirection");
    521   owl_select_add_io_dispatch(stderr_replace(), OWL_IO_READ, &stderr_redirect_handler, NULL, NULL);
     527  channel = g_io_channel_unix_new(stderr_replace());
     528  g_io_add_watch(channel, G_IO_IN | G_IO_HUP | G_IO_ERR, &stderr_redirect_handler, NULL);
     529  g_io_channel_unref(channel);
    522530#endif
    523531
  • owl.h

    r33b6431b rd427f08  
    1414#include "compat/compat.h"
    1515
    16 #ifdef HAVE_STDBOOL_H
    1716#include <stdbool.h>
    18 #else
    19 #ifndef HAVE__BOOL
    20 #define _Bool signed char
    21 #endif
    22 #define bool _Bool
    23 #define false 0
    24 #define true 1
    25 #define __bool_true_false_are_defined 1
    26 #endif  /* HAVE_STDBOOL_H */
    2717
    2818#ifndef OWL_PERL
     19#define NCURSES_ENABLE_STDBOOL_H 1
    2920#include <curses.h>
    3021#include <panel.h>
     
    130121#define OWL_MESSAGE_DIRECTION_IN    1
    131122#define OWL_MESSAGE_DIRECTION_OUT   2
    132 
    133 #define OWL_IO_READ   1
    134 #define OWL_IO_WRITE  2
    135 #define OWL_IO_EXCEPT 4
    136123
    137124#define OWL_DIRECTION_NONE      0
     
    242229  void *pval_default;  /* for types other and string */
    243230  int   ival_default;  /* for types int and bool     */
    244   char *validsettings;          /* documentation of valid settings */
     231  const char *validsettings;    /* documentation of valid settings */
    245232  char *summary;                /* summary of usage */
    246233  char *description;            /* detailed description */
     
    264251                                 * WARNING:  this approach is hard to make
    265252                                 * thread-safe... */
    266   char *(*get_tostring_fn)(const struct _owl_variable *v, const void *val);
     253  char G_GNUC_WARN_UNUSED_RESULT *(*get_tostring_fn)(const struct _owl_variable *v, const void *val);
    267254                                /* converts val to a string;
    268255                                 * caller must free the result */
     
    326313 
    327314  /* These don't take any context */
    328   char *(*cmd_args_fn)(int argc, const char *const *argv, const char *buff); 
     315  char G_GNUC_WARN_UNUSED_RESULT *(*cmd_args_fn)(int argc, const char *const *argv, const char *buff);
    329316                                /* takes argv and the full command as buff.
    330317                                 * caller must free return value if !NULL */
     
    333320
    334321  /* The following also take the active context if it's valid */
    335   char *(*cmd_ctxargs_fn)(void *ctx, int argc, const char *const *argv, const char *buff); 
     322  char G_GNUC_WARN_UNUSED_RESULT *(*cmd_ctxargs_fn)(void *ctx, int argc, const char *const *argv, const char *buff);
    336323                                /* takes argv and the full command as buff.
    337324                                 * caller must free return value if !NULL */
     
    526513} owl_zbuddylist;
    527514
    528 typedef struct _owl_timer {
    529   time_t time;
    530   int interval;
    531   void (*callback)(struct _owl_timer *, void *);
    532   void (*destroy)(struct _owl_timer *);
    533   void *data;
    534   char *name;
    535 } owl_timer;
    536 
    537515typedef struct _owl_errqueue {
    538516  owl_list errlist;
     
    545523} owl_colorpair_mgr;
    546524
    547 typedef struct _owl_io_dispatch {
    548   int fd;                                     /* FD to watch for dispatch. */
    549   int mode;
    550   bool valid;
    551   int needs_gc;
    552   void (*callback)(const struct _owl_io_dispatch *, void *); /* C function to dispatch to. */
    553   void (*destroy)(const struct _owl_io_dispatch *);  /* Destructor */
    554   void *data;
    555   GPollFD pollfd;
    556 } owl_io_dispatch;
    557 
    558525typedef struct _owl_popexec {
    559526  int refcount;
     
    561528  int winactive;
    562529  pid_t pid;                    /* or 0 if it has terminated */
    563   const owl_io_dispatch *dispatch;
     530  guint io_watch;
    564531} owl_popexec;
    565532
     
    625592  int pseudologin_notify;
    626593  struct termios startup_tio;
    627   owl_list io_dispatch_list;
    628   GList *timerlist;
    629   owl_timer *aim_nop_timer;
     594  guint aim_nop_timer;
    630595  int load_initial_subs;
    631596  FILE *debug_file;
  • perl/lib/BarnOwl.pm

    rf2d71cfa rbcde7926  
    2929use lib(get_config_dir() . "/lib");
    3030
     31use Glib;
     32use AnyEvent;
     33
    3134use BarnOwl::Hook;
    3235use BarnOwl::Hooks;
     
    3841use BarnOwl::Completion;
    3942use BarnOwl::Help;
    40 use BarnOwl::AnyEvent;
    41 
    42 unshift @AnyEvent::REGISTRY, [BarnOwl => BarnOwl::AnyEvent::];
    43 require AnyEvent;
    4443
    4544use List::Util qw(max);
     
    167166read from C<FD>.
    168167
    169 C<add_dispatch> has been deprecated in favor of C<add_io_dispatch>,
    170 and is now a wrapper for it called with C<mode> set to C<'r'>.
     168C<add_dispatch> has been deprecated in favor of C<AnyEvent>, and is
     169now a wrapper for C<add_io_dispatch> called with C<mode> set to
     170C<'r'>.
    171171
    172172=cut
     
    182182Remove a file descriptor previously registered via C<add_dispatch>
    183183
    184 C<remove_dispatch> has been deprecated in favor of
    185 C<remove_io_dispatch>.
     184C<remove_dispatch> has been deprecated in favor of C<AnyEvent>.
    186185
    187186=cut
     
    198197registered, the old one is removed.
    199198
    200 =cut
     199C<add_io_dispatch> has been deprecated in favor of C<AnyEvent>.
     200
     201=cut
     202
     203our %_io_dispatches;
    201204
    202205sub add_io_dispatch {
     
    204207    my $modeStr = shift;
    205208    my $cb = shift;
    206     my $mode = 0;
    207 
    208     $mode |= 0x1 if ($modeStr =~ /r/i); # Read
    209     $mode |= 0x2 if ($modeStr =~ /w/i); # Write
    210     if ($mode) {
    211         $mode |= 0x4;                  # Exceptional
    212         BarnOwl::Internal::add_io_dispatch($fd, $mode, $cb);
     209    my @modes;
     210
     211    push @modes, 'r' if $modeStr =~ /r/i; # Read
     212    push @modes, 'w' if $modeStr =~ /w/i; # Write
     213    if (@modes) {
     214        BarnOwl::remove_io_dispatch($fd);
     215        for my $mode (@modes) {
     216            push @{$_io_dispatches{$fd}}, AnyEvent->io(fh => $fd,
     217                                                       poll => $mode,
     218                                                       cb => $cb);
     219        }
    213220    } else {
    214221        die("Invalid I/O Dispatch mode: $modeStr");
     
    219226
    220227Remove a file descriptor previously registered via C<add_io_dispatch>
     228
     229C<remove_io_dispatch> has been deprecated in favor of C<AnyEvent>.
     230
     231=cut
     232
     233sub remove_io_dispatch {
     234    my $fd = shift;
     235    undef $_ foreach @{$_io_dispatches{$fd}};
     236    delete $_io_dispatches{$fd};
     237}
    221238
    222239=head2 create_style NAME OBJECT
  • perl/lib/BarnOwl/Complete/Client.pm

    rc6adf17 r58f4fb2  
    3737    subs        => undef,
    3838    terminal    => undef,
    39     timers      => undef,
    4039    variables   => undef,
    4140    variable    => \&complete_variable,
  • perl/lib/BarnOwl/Timer.pm

    rc6adf17 r074bdaa  
    33
    44package BarnOwl::Timer;
     5
     6use AnyEvent;
    57
    68sub new {
     
    1315    my $self = {cb => $cb};
    1416
    15     my $name = $args->{name};
    16     $name = "(unnamed)" unless defined $name;
    17 
    1817    bless($self, $class);
    1918
    20     $self->{timer} = BarnOwl::Internal::add_timer($args->{after} || 0,
    21                                                   $args->{interval} || 0,
    22                                                   $self,
    23                                                   $name);
     19    $self->{timer} = AnyEvent->timer(%$args);
    2420    return $self;
    2521}
     
    2723sub stop {
    2824    my $self = shift;
    29     if(defined($self->{timer})) {
    30         BarnOwl::Internal::remove_timer($self->{timer});
    31         undef $self->{timer};
    32     }
     25    undef $self->{timer};
    3326}
    3427
  • perl/modules/Jabber/lib/BarnOwl/Message/Jabber.pm

    rb401ef2 ra27acf7  
    161161    my ($recip, $account, $subject) = @_;
    162162    if (defined $recip) {
    163         my @cmd = ('jwrite', $recip, '-a', $account);
     163        my @cmd = ('jwrite', '-a', $account);
    164164        if (defined $subject) {
    165165            push @cmd, '-s', $subject;
    166166        }
     167        push @cmd, '--', $recip;
    167168        return BarnOwl::quote(@cmd);
    168169    } else {
  • perlconfig.c

    r3b8a563 rd427f08  
    2323
    2424
    25 SV *owl_new_sv(const char * str)
     25G_GNUC_WARN_UNUSED_RESULT SV *owl_new_sv(const char * str)
    2626{
    2727  SV *ret = newSVpv(str, 0);
     
    3636}
    3737
    38 AV *owl_new_av(const owl_list *l, SV *(*to_sv)(const void *))
     38G_GNUC_WARN_UNUSED_RESULT AV *owl_new_av(const owl_list *l, SV *(*to_sv)(const void *))
    3939{
    4040  AV *ret;
     
    5252}
    5353
    54 HV *owl_new_hv(const owl_dict *d, SV *(*to_sv)(const void *))
     54G_GNUC_WARN_UNUSED_RESULT HV *owl_new_hv(const owl_dict *d, SV *(*to_sv)(const void *))
    5555{
    5656  HV *ret;
     
    7575}
    7676
    77 SV *owl_perlconfig_message2hashref(const owl_message *m)
     77G_GNUC_WARN_UNUSED_RESULT SV *owl_perlconfig_message2hashref(const owl_message *m)
    7878{
    7979  HV *h, *stash;
     
    165165}
    166166
    167 SV *owl_perlconfig_curmessage2hashref(void)
     167G_GNUC_WARN_UNUSED_RESULT SV *owl_perlconfig_curmessage2hashref(void)
    168168{
    169169  int curmsg;
     
    183183   This has been somewhat addressed, but is still not lossless.
    184184 */
    185 owl_message * owl_perlconfig_hashref2message(SV *msg)
     185G_GNUC_WARN_UNUSED_RESULT owl_message *owl_perlconfig_hashref2message(SV *msg)
    186186{
    187187  owl_message * m;
     
    215215      owl_message_set_zwriteline(m, val);
    216216    } else if (!strcmp(key, "time")) {
     217      g_free(m->timestr);
    217218      m->timestr = g_strdup(val);
    218219      strptime(val, "%a %b %d %T %Y", &tm);
     
    250251/* Calls in a scalar context, passing it a hash reference.
    251252   If return value is non-null, caller must free. */
    252 char *owl_perlconfig_call_with_message(const char *subname, const owl_message *m)
     253G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_call_with_message(const char *subname, const owl_message *m)
    253254{
    254255  dSP ;
     
    299300   If the return value is non-null, the caller must free it.
    300301 */
    301 char * owl_perlconfig_message_call_method(const owl_message *m, const char *method, int argc, const char ** argv)
     302G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_message_call_method(const owl_message *m, const char *method, int argc, const char **argv)
    302303{
    303304  dSP;
     
    348349}
    349350
    350 
    351 char *owl_perlconfig_initperl(const char * file, int *Pargc, char ***Pargv, char *** Penv)
     351/* caller must free result, if not NULL */
     352G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_initperl(const char *file, int *Pargc, char ***Pargv, char ***Penv)
    352353{
    353354  int ret;
     
    435436
    436437/* caller is responsible for freeing returned string */
    437 char *owl_perlconfig_execute(const char *line)
     438G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_execute(const char *line)
    438439{
    439440  STRLEN len;
     
    492493  PUTBACK;
    493494
    494   call_pv("BarnOwl::Hooks::_new_command", G_SCALAR|G_VOID|G_EVAL);
     495  call_pv("BarnOwl::Hooks::_new_command", G_VOID|G_EVAL);
    495496
    496497  SPAGAIN;
     
    504505}
    505506
    506 char *owl_perlconfig_perlcmd(const owl_cmd *cmd, int argc, const char *const *argv)
     507/* caller must free the result */
     508G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_perlcmd(const owl_cmd *cmd, int argc, const char *const *argv)
    507509{
    508510  int i, count;
     
    547549}
    548550
    549 void owl_perlconfig_io_dispatch_destroy(const owl_io_dispatch *d)
    550 {
    551   SvREFCNT_dec(d->data);
    552 }
    553 
    554551void owl_perlconfig_edit_callback(owl_editwin *e)
    555552{
     
    586583  SvREFCNT_dec(v);
    587584}
    588 
    589 void owl_perlconfig_io_dispatch(const owl_io_dispatch *d, void *data)
    590 {
    591   SV *cb = data;
    592   dSP;
    593   if(cb == NULL) {
    594     owl_function_error("Perl callback is NULL!");
    595     return;
    596   }
    597 
    598   ENTER;
    599   SAVETMPS;
    600 
    601   PUSHMARK(SP);
    602   PUTBACK;
    603 
    604   call_sv(cb, G_DISCARD|G_EVAL);
    605 
    606   if(SvTRUE(ERRSV)) {
    607     owl_function_error("%s", SvPV_nolen(ERRSV));
    608   }
    609 
    610   FREETMPS;
    611   LEAVE;
    612 }
    613 
    614 void owl_perlconfig_perl_timer(owl_timer *t, void *data)
    615 {
    616   dSP;
    617   SV *obj = data;
    618 
    619   if(!SvROK(obj)) {
    620     return;
    621   }
    622 
    623   ENTER;
    624   SAVETMPS;
    625 
    626   PUSHMARK(SP);
    627   XPUSHs(obj);
    628   PUTBACK;
    629 
    630   call_method("do_callback", G_DISCARD|G_EVAL);
    631 
    632   SPAGAIN;
    633 
    634   if (SvTRUE(ERRSV)) {
    635     owl_function_error("Error in callback: '%s'", SvPV_nolen(ERRSV));
    636     sv_setsv (ERRSV, &PL_sv_undef);
    637   }
    638 
    639   PUTBACK;
    640   FREETMPS;
    641   LEAVE;
    642 }
    643 
    644 void owl_perlconfig_perl_timer_destroy(owl_timer *t)
    645 {
    646   if(SvOK((SV*)t->data)) {
    647     SvREFCNT_dec((SV*)t->data);
    648   }
    649 }
  • perlglue.xs

    r3b8a563 rbcde7926  
    326326                g_free(rv);
    327327
    328 void
    329 remove_io_dispatch(fd)
    330         int fd
    331         CODE:
    332         owl_select_remove_perl_io_dispatch(fd);
    333 
    334328AV*
    335329all_filters()
     
    507501                                      ival);
    508502
    509 void
    510 add_io_dispatch(fd, mode, cb)
    511         int fd
    512         int mode
    513         SV * cb
    514         CODE:
    515         owl_select_add_perl_io_dispatch(fd, mode, newSVsv(cb));
    516 
    517 IV
    518 add_timer(after, interval, cb, name = NULL)
    519         int after
    520         int interval
    521         SV *cb
    522         const char *name
    523         PREINIT:
    524                 SV *ref;
    525                 owl_timer *t;
    526         CODE:
    527                 ref = sv_rvweaken(newSVsv(cb));
    528                 t = owl_select_add_timer(name,
    529                                          after,
    530                                          interval,
    531                                          owl_perlconfig_perl_timer,
    532                                          owl_perlconfig_perl_timer_destroy,
    533                                          ref);
    534                 owl_function_debugmsg("Created timer %s: %p", t->name ? t->name : "(unnamed)", t);
    535         RETVAL = (IV)t;
    536         OUTPUT:
    537                 RETVAL
    538 
    539 void
    540 remove_timer(timer)
    541         IV timer
    542         PREINIT:
    543                 owl_timer *t;
    544         CODE:
    545                 t = (owl_timer*)timer;
    546                 owl_function_debugmsg("Freeing timer %s: %p", t->name ? t->name : "(unnamed)", t);
    547                 owl_select_remove_timer(t);
    548 
    549503MODULE = BarnOwl                PACKAGE = BarnOwl::Editwin
    550504
  • popexec.c

    r47e0a6a re146cd7  
    1616  int pipefds[2], child_write_fd, parent_read_fd;
    1717  pid_t pid;
     18  GIOChannel *channel;
    1819
    1920  if (owl_global_get_popwin(&g) || owl_global_get_viewwin(&g)) {
     
    5455    pe->pid=pid;
    5556    pe->winactive=1;
    56     pe->dispatch = owl_select_add_io_dispatch(parent_read_fd, OWL_IO_READ|OWL_IO_EXCEPT, &owl_popexec_inputhandler, &owl_popexec_delete_dispatch, pe);
     57    channel = g_io_channel_unix_new(parent_read_fd);
     58    g_io_channel_set_close_on_unref(channel, TRUE);
     59    pe->io_watch = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT,
     60                                       G_IO_IN | G_IO_ERR | G_IO_HUP,
     61                                       owl_popexec_inputhandler, pe,
     62                                       (GDestroyNotify)owl_popexec_unref);
     63    g_io_channel_unref(channel);
    5764    pe->refcount++;
    5865  } else {
     
    7582}
    7683
    77 void owl_popexec_inputhandler(const owl_io_dispatch *d, void *data)
     84gboolean owl_popexec_inputhandler(GIOChannel *source, GIOCondition condition, void *data)
    7885{
    7986  owl_popexec *pe = data;
     
    8188  char *buf;
    8289  int status;
     90  int fd = g_io_channel_unix_get_fd(source);
    8391
    84   if (!pe) return;
     92  /* TODO: Reading from GIOChannel may be more convenient. */
     93
     94  if (!pe) return FALSE;
    8595
    8696  /* If pe->winactive is 0 then the vwin has closed.
     
    96106  /* the viewwin has closed */
    97107  if (!pe->pid && !pe->winactive) {
    98     owl_select_remove_io_dispatch(d);
    99     pe->dispatch = NULL;
    100     return;
     108    pe->io_watch = 0;
     109    return FALSE;
    101110  }
    102111
    103   if (0 != (rv_navail = ioctl(d->fd, FIONREAD, &navail))) {
     112  if (0 != (rv_navail = ioctl(fd, FIONREAD, &navail))) {
    104113    owl_function_debugmsg("ioctl error");
    105114  }
     
    113122      owl_viewwin_append_text(pe->vwin, "\n");
    114123    }
    115     owl_select_remove_io_dispatch(d);
    116     pe->dispatch = NULL;
    117     return;
     124    pe->io_watch = 0;
     125    return FALSE;
    118126  }
    119127
    120   if (d->fd<0 || !pe->pid || !pe->winactive || rv_navail) {
     128  if (fd<0 || !pe->pid || !pe->winactive || rv_navail) {
    121129    owl_function_error("popexec should not have reached this point");
    122     return;
     130    return FALSE;
    123131  }
    124132
    125   if (navail<=0) return;
     133  if (navail<=0) return TRUE;
    126134  if (navail>1024) { navail = 1024; }
    127135  buf = g_new(char, navail+1);
    128136  owl_function_debugmsg("about to read %d", navail);
    129   bread = read(d->fd, buf, navail);
     137  bread = read(fd, buf, navail);
    130138  if (bread<0) {
    131139    perror("read");
     
    140148  }
    141149  g_free(buf);
    142  
    143 }
    144 
    145 void owl_popexec_delete_dispatch(const owl_io_dispatch *d)
    146 {
    147   owl_popexec *pe = d->data;
    148   close(d->fd);
    149   owl_popexec_unref(pe);
     150  return TRUE;
    150151}
    151152
     
    156157
    157158  pe->winactive = 0;
    158   if (pe->dispatch) {
    159     owl_select_remove_io_dispatch(pe->dispatch);
    160     pe->dispatch = NULL;
     159  if (pe->io_watch) {
     160    g_source_remove(pe->io_watch);
     161    pe->io_watch = 0;
    161162  }
    162163  if (pe->pid) {
  • popwin.c

    rddbbcffa rd427f08  
    11#include "owl.h"
    22
    3 owl_popwin *owl_popwin_new(void)
     3G_GNUC_WARN_UNUSED_RESULT owl_popwin *owl_popwin_new(void)
    44{
    55  owl_popwin *pw = g_new0(owl_popwin, 1);
  • regex.c

    rd4927a7 rd427f08  
    3939{
    4040  char *quoted;
     41  int ret;
    4142 
    42   quoted=owl_text_quote(string, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
    43   owl_regex_create(re, quoted);
     43  quoted = owl_text_quote(string, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
     44  ret = owl_regex_create(re, quoted);
    4445  g_free(quoted);
    45   return(0);
     46  return ret;
    4647}
    4748
  • scripts/locker-build

    r0fd5bd5 r4f5e38f  
    102102    esac
    103103
    104     CFLAGS="-I$BARNOWL/include" \
    105         LDFLAGS="-L$BARNOWL/lib $opt_rpath$BARNOWL/lib" \
     104    CPPFLAGS="-I$BARNOWL/include -I/usr/athena/include" \
     105        LDFLAGS="-L$BARNOWL/lib -L/usr/athena/lib $opt_rpath$BARNOWL/lib" \
    106106        ./configure --exec-prefix="/mit/barnowl/arch/$ATHENA_SYS" \
    107107        --prefix="/mit/barnowl/builds/barnowl-$VERS" --mandir=/mit/barnowl/man \
  • select.c

    r44976fe r84a071f  
    22
    33static GMainLoop *loop = NULL;
    4 static GMainContext *main_context;
    5 static int dispatch_active = 0;
    6 
    7 static GSource *owl_timer_source;
    8 static GSource *owl_io_dispatch_source;
    9 
    10 static int _owl_select_timer_cmp(const owl_timer *t1, const owl_timer *t2) {
    11   return t1->time - t2->time;
    12 }
    13 
    14 owl_timer *owl_select_add_timer(const char* name, int after, int interval, void (*cb)(owl_timer *, void *), void (*destroy)(owl_timer*), void *data)
    15 {
    16   owl_timer *t = g_new(owl_timer, 1);
    17   GList **timers = owl_global_get_timerlist(&g);
    18 
    19   t->time = time(NULL) + after;
    20   t->interval = interval;
    21   t->callback = cb;
    22   t->destroy = destroy;
    23   t->data = data;
    24   t->name = name ? g_strdup(name) : NULL;
    25 
    26   *timers = g_list_insert_sorted(*timers, t,
    27                                  (GCompareFunc)_owl_select_timer_cmp);
    28   return t;
    29 }
    30 
    31 void owl_select_remove_timer(owl_timer *t)
    32 {
    33   GList **timers = owl_global_get_timerlist(&g);
    34   if (t && g_list_find(*timers, t)) {
    35     *timers = g_list_remove(*timers, t);
    36     if(t->destroy) {
    37       t->destroy(t);
    38     }
    39     g_free(t->name);
    40     g_free(t);
    41   }
    42 }
    43 
    44 static gboolean owl_timer_prepare(GSource *source, int *timeout) {
    45   GList **timers = owl_global_get_timerlist(&g);
    46   GTimeVal now;
    47 
    48   /* TODO: In the far /far/ future, g_source_get_time is what the cool
    49    * kids use to get system monotonic time. */
    50   g_source_get_current_time(source, &now);
    51 
    52   /* FIXME: bother with millisecond accuracy now that we can? */
    53   if (*timers) {
    54     owl_timer *t = (*timers)->data;
    55     *timeout = t->time - now.tv_sec;
    56     if (*timeout <= 0) {
    57       *timeout = 0;
    58       return TRUE;
    59     }
    60     if (*timeout > 60 * 1000)
    61       *timeout = 60 * 1000;
    62   } else {
    63     *timeout = 60 * 1000;
    64   }
    65   return FALSE;
    66 }
    67 
    68 static gboolean owl_timer_check(GSource *source) {
    69   GList **timers = owl_global_get_timerlist(&g);
    70   GTimeVal now;
    71 
    72   /* TODO: In the far /far/ future, g_source_get_time is what the cool
    73    * kids use to get system monotonic time. */
    74   g_source_get_current_time(source, &now);
    75 
    76   /* FIXME: bother with millisecond accuracy now that we can? */
    77   if (*timers) {
    78     owl_timer *t = (*timers)->data;
    79     return t->time >= now.tv_sec;
    80   }
    81   return FALSE;
    82 }
    83 
    84 
    85 static gboolean owl_timer_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) {
    86   GList **timers = owl_global_get_timerlist(&g);
    87   GTimeVal now;
    88 
    89   /* TODO: In the far /far/ future, g_source_get_time is what the cool
    90    * kids use to get system monotonic time. */
    91   g_source_get_current_time(source, &now);
    92 
    93   /* FIXME: bother with millisecond accuracy now that we can? */
    94   while(*timers) {
    95     owl_timer *t = (*timers)->data;
    96     int remove = 0;
    97 
    98     if(t->time > now.tv_sec)
    99       break;
    100 
    101     /* Reschedule if appropriate */
    102     if(t->interval > 0) {
    103       t->time = now.tv_sec + t->interval;
    104       *timers = g_list_remove(*timers, t);
    105       *timers = g_list_insert_sorted(*timers, t,
    106                                      (GCompareFunc)_owl_select_timer_cmp);
    107     } else {
    108       remove = 1;
    109     }
    110 
    111     /* Do the callback */
    112     t->callback(t, t->data);
    113     if(remove) {
    114       owl_select_remove_timer(t);
    115     }
    116   }
    117   return TRUE;
    118 }
    119 
    120 static GSourceFuncs owl_timer_funcs = {
    121   owl_timer_prepare,
    122   owl_timer_check,
    123   owl_timer_dispatch,
    124   NULL
    125 };
    126 
    127 /* Returns the valid owl_io_dispatch for a given file descriptor. */
    128 static owl_io_dispatch *owl_select_find_valid_io_dispatch_by_fd(const int fd)
    129 {
    130   int i, len;
    131   const owl_list *dl;
    132   owl_io_dispatch *d;
    133   dl = owl_global_get_io_dispatch_list(&g);
    134   len = owl_list_get_size(dl);
    135   for(i = 0; i < len; i++) {
    136     d = owl_list_get_element(dl, i);
    137     if (d->fd == fd && d->valid) return d;
    138   }
    139   return NULL;
    140 }
    141 
    142 static int owl_select_find_io_dispatch(const owl_io_dispatch *in)
    143 {
    144   int i, len;
    145   const owl_list *dl;
    146 
    147   if (in != NULL) {
    148     dl = owl_global_get_io_dispatch_list(&g);
    149     len = owl_list_get_size(dl);
    150     for(i = 0; i < len; i++) {
    151       const owl_io_dispatch *d = owl_list_get_element(dl, i);
    152       if (d == in) return i;
    153     }
    154   }
    155   return -1;
    156 }
    157 
    158 static void owl_select_invalidate_io_dispatch(owl_io_dispatch *d)
    159 {
    160   if (d == NULL || !d->valid)
    161     return;
    162   d->valid = false;
    163   g_source_remove_poll(owl_io_dispatch_source, &d->pollfd);
    164 }
    165 
    166 void owl_select_remove_io_dispatch(const owl_io_dispatch *in)
    167 {
    168   int elt;
    169   if (in != NULL) {
    170     elt = owl_select_find_io_dispatch(in);
    171     if (elt != -1) {
    172       owl_list *dl = owl_global_get_io_dispatch_list(&g);
    173       owl_io_dispatch *d = owl_list_get_element(dl, elt);
    174       if (dispatch_active)
    175         d->needs_gc = 1;
    176       else {
    177         owl_select_invalidate_io_dispatch(d);
    178         owl_list_remove_element(dl, elt);
    179         if (d->destroy)
    180           d->destroy(d);
    181         g_free(d);
    182       }
    183     }
    184   }
    185 }
    186 
    187 static void owl_select_io_dispatch_gc(void)
    188 {
    189   int i;
    190   owl_list *dl;
    191 
    192   dl = owl_global_get_io_dispatch_list(&g);
    193   /*
    194    * Count down so we aren't set off by removing items from the list
    195    * during the iteration.
    196    */
    197   for(i = owl_list_get_size(dl) - 1; i >= 0; i--) {
    198     owl_io_dispatch *d = owl_list_get_element(dl, i);
    199     if(d->needs_gc) {
    200       owl_select_remove_io_dispatch(d);
    201     }
    202   }
    203 }
    204 
    205 /* Each FD may have at most one valid dispatcher.
    206  * If a new dispatch is added for an FD, the old one is removed.
    207  * mode determines what types of events are watched for, and may be any combination of:
    208  * OWL_IO_READ, OWL_IO_WRITE, OWL_IO_EXCEPT
    209  */
    210 const owl_io_dispatch *owl_select_add_io_dispatch(int fd, int mode, void (*cb)(const owl_io_dispatch *, void *), void (*destroy)(const owl_io_dispatch *), void *data)
    211 {
    212   owl_io_dispatch *d = g_new(owl_io_dispatch, 1);
    213   owl_list *dl = owl_global_get_io_dispatch_list(&g);
    214   owl_io_dispatch *other;
    215 
    216   d->fd = fd;
    217   d->valid = true;
    218   d->needs_gc = 0;
    219   d->mode = mode;
    220   d->callback = cb;
    221   d->destroy = destroy;
    222   d->data = data;
    223 
    224   /* TODO: Allow changing fd and mode in the middle? Probably don't care... */
    225   d->pollfd.fd = fd;
    226   d->pollfd.events = 0;
    227   if (d->mode & OWL_IO_READ)
    228     d->pollfd.events |= G_IO_IN | G_IO_HUP | G_IO_ERR;
    229   if (d->mode & OWL_IO_WRITE)
    230     d->pollfd.events |= G_IO_OUT | G_IO_ERR;
    231   if (d->mode & OWL_IO_EXCEPT)
    232     d->pollfd.events |= G_IO_PRI | G_IO_ERR;
    233   g_source_add_poll(owl_io_dispatch_source, &d->pollfd);
    234 
    235 
    236   other = owl_select_find_valid_io_dispatch_by_fd(fd);
    237   if (other)
    238     owl_select_invalidate_io_dispatch(other);
    239   owl_list_append_element(dl, d);
    240 
    241   return d;
    242 }
    243 
    244 static gboolean owl_io_dispatch_prepare(GSource *source, int *timeout) {
    245   *timeout = -1;
    246   return FALSE;
    247 }
    248 
    249 static gboolean owl_io_dispatch_check(GSource *source) {
    250   int i, len;
    251   const owl_list *dl;
    252 
    253   dl = owl_global_get_io_dispatch_list(&g);
    254   len = owl_list_get_size(dl);
    255   for(i = 0; i < len; i++) {
    256     owl_io_dispatch *d = owl_list_get_element(dl, i);
    257     if (!d->valid) continue;
    258     if (d->pollfd.revents & G_IO_NVAL) {
    259       owl_function_debugmsg("Pruning defunct dispatch on fd %d.", d->fd);
    260       owl_select_invalidate_io_dispatch(d);
    261     }
    262     if (d->pollfd.revents & d->pollfd.events)
    263       return TRUE;
    264   }
    265   return FALSE;
    266 }
    267 
    268 static gboolean owl_io_dispatch_dispatch(GSource *source, GSourceFunc callback, gpointer user_data) {
    269   int i, len;
    270   const owl_list *dl;
    271 
    272   dispatch_active = 1;
    273   dl = owl_global_get_io_dispatch_list(&g);
    274   len = owl_list_get_size(dl);
    275   for (i = 0; i < len; i++) {
    276     owl_io_dispatch *d = owl_list_get_element(dl, i);
    277     if (!d->valid) continue;
    278     if ((d->pollfd.revents & d->pollfd.events) && d->callback != NULL) {
    279       d->callback(d, d->data);
    280     }
    281   }
    282   dispatch_active = 0;
    283   owl_select_io_dispatch_gc();
    284 
    285   return TRUE;
    286 }
    287 
    288 static GSourceFuncs owl_io_dispatch_funcs = {
    289   owl_io_dispatch_prepare,
    290   owl_io_dispatch_check,
    291   owl_io_dispatch_dispatch,
    292   NULL
    293 };
    294 
    295 int owl_select_add_perl_io_dispatch(int fd, int mode, SV *cb)
    296 {
    297   const owl_io_dispatch *d = owl_select_find_valid_io_dispatch_by_fd(fd);
    298   if (d != NULL && d->callback != owl_perlconfig_io_dispatch) {
    299     /* Don't mess with non-perl dispatch functions from here. */
    300     return 1;
    301   }
    302   /* Also remove any invalidated perl dispatch functions that may have
    303    * stuck around. */
    304   owl_select_remove_perl_io_dispatch(fd);
    305   owl_select_add_io_dispatch(fd, mode, owl_perlconfig_io_dispatch, owl_perlconfig_io_dispatch_destroy, cb);
    306   return 0;
    307 }
    308 
    309 static owl_io_dispatch *owl_select_find_perl_io_dispatch(int fd)
    310 {
    311   int i, len;
    312   const owl_list *dl;
    313   owl_io_dispatch *d;
    314   dl = owl_global_get_io_dispatch_list(&g);
    315   len = owl_list_get_size(dl);
    316   for(i = 0; i < len; i++) {
    317     d = owl_list_get_element(dl, i);
    318     if (d->fd == fd && d->callback == owl_perlconfig_io_dispatch)
    319       return d;
    320   }
    321   return NULL;
    322 }
    323 
    324 int owl_select_remove_perl_io_dispatch(int fd)
    325 {
    326   owl_io_dispatch *d = owl_select_find_perl_io_dispatch(fd);
    327   if (d != NULL) {
    328     /* Only remove perl io dispatchers from here. */
    329     owl_select_remove_io_dispatch(d);
    330     return 0;
    331   }
    332   return 1;
    333 }
    3344
    3355void owl_select_init(void)
    3366{
    337   owl_timer_source = g_source_new(&owl_timer_funcs, sizeof(GSource));
    338   g_source_attach(owl_timer_source, NULL);
    339 
    340   owl_io_dispatch_source = g_source_new(&owl_io_dispatch_funcs, sizeof(GSource));
    341   g_source_attach(owl_io_dispatch_source, NULL);
    3427}
    3438
    3449void owl_select_run_loop(void)
    34510{
    346   main_context = g_main_context_default();
    347   loop = g_main_loop_new(main_context, FALSE);
     11  loop = g_main_loop_new(NULL, FALSE);
    34812  g_main_loop_run(loop);
    34913}
     
    35317  if (loop) {
    35418    g_main_loop_quit(loop);
     19    g_main_loop_unref(loop);
    35520    loop = NULL;
    35621  }
  • tester.c

    r4c7c21f r4e37d56  
    3232  char *perlerr;
    3333  int status = 0;
     34  SCREEN *screen;
    3435
    3536  if (argc <= 1) {
     
    4142  wnull = fopen("/dev/null", "w");
    4243  rnull = fopen("/dev/null", "r");
    43   newterm("xterm", wnull, rnull);
     44  screen = newterm("xterm", wnull, rnull);
    4445  /* initialize global structures */
    4546  owl_global_init(&g);
     
    9192  /* probably not necessary, but tear down the screen */
    9293  endwin();
     94  delscreen(screen);
    9395  fclose(rnull);
    9496  fclose(wnull);
     
    218220  owl_string_appendf_quoted(g, "%q foo %q%q %s %", "hello", "world is", "can't");
    219221  FAIL_UNLESS("owl_string_appendf",
    220               !strcmp(g_string_free(g, false),
    221                       "hello foo 'world is'\"can't\" %s %"));
     222              !strcmp(g->str, "hello foo 'world is'\"can't\" %s %"));
     223  g_string_free(g, true);
    222224
    223225  /* if (numfailed) printf("*** WARNING: failures encountered with owl_util\n"); */
     
    230232  owl_list l;
    231233  int numfailed=0;
    232   char *av="aval", *bv="bval", *cv="cval", *dv="dval";
     234  char *av = g_strdup("aval"), *bv = g_strdup("bval"), *cv = g_strdup("cval"),
     235    *dv = g_strdup("dval");
    233236
    234237  printf("# BEGIN testing owl_dict\n");
     
    259262  owl_list_cleanup(&l, g_free);
    260263  owl_dict_cleanup(&d, NULL);
     264
     265  g_free(av);
     266  g_free(bv);
     267  g_free(cv);
     268  g_free(dv);
    261269
    262270  /*  if (numfailed) printf("*** WARNING: failures encountered with owl_dict\n"); */
  • text.c

    r7865479 rd427f08  
    77/* Returns a copy of 'in' with each line indented 'n'
    88 * characters. Result must be freed with g_free. */
    9 char *owl_text_indent(const char *in, int n)
     9G_GNUC_WARN_UNUSED_RESULT char *owl_text_indent(const char *in, int n)
    1010{
    1111  const char *ptr1, *ptr2, *last;
     
    4848
    4949/* caller must free the return */
    50 char *owl_text_htmlstrip(const char *in)
     50G_GNUC_WARN_UNUSED_RESULT char *owl_text_htmlstrip(const char *in)
    5151{
    5252  const char *ptr1, *end, *ptr2, *ptr3;
     
    129129
    130130/* Caller must free return */
    131 char *owl_text_expand_tabs(const char *in)
     131G_GNUC_WARN_UNUSED_RESULT char *owl_text_expand_tabs(const char *in)
    132132{
    133133  int len = 0;
     
    188188
    189189/* caller must free the return */
    190 char *owl_text_wordwrap(const char *in, int col)
     190G_GNUC_WARN_UNUSED_RESULT char *owl_text_wordwrap(const char *in, int col)
    191191{
    192192  char *out;
     
    269269 * Caller must free returned string.
    270270 */
    271 char *owl_text_substitute(const char *in, const char *from, const char *to)
     271G_GNUC_WARN_UNUSED_RESULT char *owl_text_substitute(const char *in, const char *from, const char *to)
    272272{
    273273  char **split = g_strsplit(in, from, 0), *out;
     
    284284 * On success returns the string, on error returns NULL.
    285285 */
    286 char *owl_text_quote(const char *in, const char *toquote, const char *quotestr)
     286G_GNUC_WARN_UNUSED_RESULT char *owl_text_quote(const char *in, const char *toquote, const char *quotestr)
    287287{
    288288  int i, x, r, place, escape;
  • util.c

    r9efa5bd rd427f08  
    3535 * duplicate slashes are removed.  Caller must free the return.
    3636 */
    37 char *owl_util_makepath(const char *in)
     37G_GNUC_WARN_UNUSED_RESULT char *owl_util_makepath(const char *in)
    3838{
    3939  int i, j, x;
     
    102102   to -1, argv will be NULL and the caller does not need to free anything. The
    103103   returned vector is NULL-terminated. */
    104 char **owl_parseline(const char *line, int *argc)
     104G_GNUC_WARN_UNUSED_RESULT char **owl_parseline(const char *line, int *argc)
    105105{
    106106  GPtrArray *argv;
     
    245245}
    246246
    247 char *owl_string_build_quoted(const char *tmpl, ...)
     247G_GNUC_WARN_UNUSED_RESULT char *owl_string_build_quoted(const char *tmpl, ...)
    248248{
    249249  GString *buf = g_string_new("");
     
    257257/* Returns a quoted version of arg suitable for placing in a
    258258 * command-line. Result should be freed with g_free. */
    259 char *owl_arg_quote(const char *arg)
     259G_GNUC_WARN_UNUSED_RESULT char *owl_arg_quote(const char *arg)
    260260{
    261261  GString *buf = g_string_new("");;
     
    265265
    266266/* caller must free the return */
    267 char *owl_util_minutes_to_timestr(int in)
     267G_GNUC_WARN_UNUSED_RESULT char *owl_util_minutes_to_timestr(int in)
    268268{
    269269  int days, hours;
     
    331331
    332332/* Get the default tty name.  Caller must free the return */
    333 char *owl_util_get_default_tty(void)
     333G_GNUC_WARN_UNUSED_RESULT char *owl_util_get_default_tty(void)
    334334{
    335335  const char *tmp;
     
    353353 * return.
    354354 */
    355 char *owl_util_stripnewlines(const char *in)
     355G_GNUC_WARN_UNUSED_RESULT char *owl_util_stripnewlines(const char *in)
    356356{
    357357 
     
    384384 * Error conditions are the same as g_file_read_link.
    385385 */
    386 gchar *owl_util_recursive_resolve_link(const char *filename)
     386G_GNUC_WARN_UNUSED_RESULT gchar *owl_util_recursive_resolve_link(const char *filename)
    387387{
    388388  gchar *last_path = g_strdup(filename);
     
    455455    g_free(newfile);
    456456    fclose(old);
    457     free(actual_filename);
     457    g_free(actual_filename);
    458458    return -1;
    459459  }
     
    466466    g_free(newfile);
    467467    fclose(old);
    468     free(actual_filename);
     468    g_free(actual_filename);
    469469    return -1;
    470470  }
     
    511511   The caller is responsible for freeing the allocated string.
    512512*/
    513 char * owl_util_baseclass(const char * class)
     513G_GNUC_WARN_UNUSED_RESULT char *owl_util_baseclass(const char *class)
    514514{
    515515  char *start, *end;
     
    546546
    547547/* Strips format characters from a valid utf-8 string. Returns the
    548    empty string if 'in' does not validate. */
    549 char * owl_strip_format_chars(const char *in)
     548   empty string if 'in' does not validate.  Caller must free the return. */
     549G_GNUC_WARN_UNUSED_RESULT char *owl_strip_format_chars(const char *in)
    550550{
    551551  char *r;
     
    584584 * out characters in Unicode Plane 16, as we use that plane internally
    585585 * for formatting.
    586  */
    587 char * owl_validate_or_convert(const char *in)
     586 * Caller must free the return.
     587 */
     588G_GNUC_WARN_UNUSED_RESULT char *owl_validate_or_convert(const char *in)
    588589{
    589590  if (g_utf8_validate(in, -1, NULL)) {
     
    599600 * Validate 'in' as UTF-8, and either return a copy of it, or an empty
    600601 * string if it is invalid utf-8.
    601  */
    602 char * owl_validate_utf8(const char *in)
     602 * Caller must free the return.
     603 */
     604G_GNUC_WARN_UNUSED_RESULT char *owl_validate_utf8(const char *in)
    603605{
    604606  char *out;
     
    632634}
    633635
    634 char *owl_escape_highbit(const char *str)
     636/* caller must free the return */
     637G_GNUC_WARN_UNUSED_RESULT char *owl_escape_highbit(const char *str)
    635638{
    636639  GString *out = g_string_new("");
     
    695698
    696699/* Read the rest of the input available in fp into a string. */
    697 char *owl_slurp(FILE *fp)
     700G_GNUC_WARN_UNUSED_RESULT char *owl_slurp(FILE *fp)
    698701{
    699702  char *buf = NULL;
  • variable.c

    r4c7c21f rd427f08  
    77
    88#define OWLVAR_BOOL(name,default,summary,description) \
    9         { name, OWL_VARIABLE_BOOL, NULL, default, "on,off", summary,description, NULL, \
     9        { g_strdup(name), OWL_VARIABLE_BOOL, NULL, default, "on,off", g_strdup(summary), g_strdup(description), NULL, \
    1010        NULL, NULL, NULL, NULL, NULL, NULL }
    1111
    1212#define OWLVAR_BOOL_FULL(name,default,summary,description,validate,set,get) \
    13         { name, OWL_VARIABLE_BOOL, NULL, default, "on,off", summary,description, NULL, \
     13        { g_strdup(name), OWL_VARIABLE_BOOL, NULL, default, "on,off", g_strdup(summary), g_strdup(description), NULL, \
    1414        validate, set, NULL, get, NULL, NULL }
    1515
    1616#define OWLVAR_INT(name,default,summary,description) \
    17         { name, OWL_VARIABLE_INT, NULL, default, "<int>", summary,description, NULL, \
     17        { g_strdup(name), OWL_VARIABLE_INT, NULL, default, "<int>", g_strdup(summary), g_strdup(description), NULL, \
    1818        NULL, NULL, NULL, NULL, NULL, NULL }
    1919
    2020#define OWLVAR_INT_FULL(name,default,summary,description,validset,validate,set,get) \
    21         { name, OWL_VARIABLE_INT, NULL, default, validset, summary,description, NULL, \
     21        { g_strdup(name), OWL_VARIABLE_INT, NULL, default, validset, g_strdup(summary), g_strdup(description), NULL, \
    2222        validate, set, NULL, get, NULL, NULL }
    2323
    2424#define OWLVAR_PATH(name,default,summary,description) \
    25         { name, OWL_VARIABLE_STRING, default, 0, "<path>", summary,description,  NULL, \
     25        { g_strdup(name), OWL_VARIABLE_STRING, g_strdup(default), 0, "<path>", g_strdup(summary), g_strdup(description),  NULL, \
    2626        NULL, NULL, NULL, NULL, NULL, NULL }
    2727
    2828#define OWLVAR_STRING(name,default,summary,description) \
    29         { name, OWL_VARIABLE_STRING, default, 0, "<string>", summary,description, NULL, \
     29        { g_strdup(name), OWL_VARIABLE_STRING, g_strdup(default), 0, "<string>", g_strdup(summary), g_strdup(description), NULL, \
    3030        NULL, NULL, NULL, NULL, NULL, NULL }
    3131
    3232#define OWLVAR_STRING_FULL(name,default,validset,summary,description,validate,set,get) \
    33         { name, OWL_VARIABLE_STRING, default, 0, validset, summary,description, NULL, \
     33        { g_strdup(name), OWL_VARIABLE_STRING, g_strdup(default), 0, validset, g_strdup(summary), g_strdup(description), NULL, \
    3434        validate, set, NULL, get, NULL, NULL }
    3535
     
    3838 * correspond to the values that may be specified. */
    3939#define OWLVAR_ENUM(name,default,summary,description,validset) \
    40         { name, OWL_VARIABLE_INT, NULL, default, validset, summary,description, NULL, \
     40        { g_strdup(name), OWL_VARIABLE_INT, NULL, default, validset, g_strdup(summary), g_strdup(description), NULL, \
    4141        owl_variable_enum_validate, \
    4242        NULL, owl_variable_enum_set_fromstring, \
     
    4545
    4646#define OWLVAR_ENUM_FULL(name,default,summary,description,validset,validate, set, get) \
    47         { name, OWL_VARIABLE_INT, NULL, default, validset, summary,description, NULL, \
     47        { g_strdup(name), OWL_VARIABLE_INT, NULL, default, validset, g_strdup(summary), g_strdup(description), NULL, \
    4848        validate, \
    4949        set, owl_variable_enum_set_fromstring, \
     
    5151        NULL }
    5252
    53 static owl_variable variables_to_init[] = {
     53int owl_variable_add_defaults(owl_vardict *vd)
     54{
     55  owl_variable variables_to_init[] = {
    5456
    5557  OWLVAR_STRING( "personalbell" /* %OwlVarStub */, "off",
     
    439441    NULL, NULL, NULL, NULL, NULL, NULL }
    440442
    441 };
     443  };
     444
     445  int ret = owl_variable_dict_add_from_list(vd, variables_to_init);
     446  owl_variable *var;
     447  for (var = variables_to_init; var->name != NULL; var++)
     448    owl_variable_cleanup(var);
     449  return ret;
     450}
    442451
    443452/**************************************************************************/
     
    495504int owl_variable_pseudologins_set(owl_variable *v, const void *newval)
    496505{
    497   static owl_timer *timer = NULL;
     506  static guint timer = 0;
    498507  if (newval) {
    499508    if (*(const int*)newval == 1) {
    500509      owl_function_zephyr_buddy_check(0);
    501       if (timer == NULL) {
    502         timer = owl_select_add_timer("owl_zephyr_buddycheck_timer",
    503                                      180, 180, owl_zephyr_buddycheck_timer, NULL, NULL);
     510      if (timer == 0) {
     511        timer = g_timeout_add_seconds(180, owl_zephyr_buddycheck_timer, NULL);
    504512      }
    505513    } else {
    506       if (timer != NULL) {
    507         owl_select_remove_timer(timer);
    508         timer = NULL;
     514      if (timer != 0) {
     515        g_source_remove(timer);
     516        timer = 0;
    509517      }
    510518    }
     
    558566
    559567int owl_variable_dict_setup(owl_vardict *vd) {
     568  owl_dict_create(vd);
     569  return owl_variable_add_defaults(vd);
     570}
     571
     572int owl_variable_dict_add_from_list(owl_vardict *vd, owl_variable *variables_to_init)
     573{
    560574  owl_variable *var, *cur;
    561   owl_dict_create(vd);
    562575  for (var = variables_to_init; var->name != NULL; var++) {
    563576    cur = g_new(owl_variable, 1);
     
    584597      if (!cur->delete_fn)
    585598        cur->delete_fn = owl_variable_delete_default;
     599      cur->pval_default = g_strdup(var->pval_default);
    586600      cur->set_fn(cur, cur->pval_default);
    587601      break;
     
    632646}
    633647
    634 owl_variable * owl_variable_newvar(const char *name, const char *summary, const char * description) {
     648G_GNUC_WARN_UNUSED_RESULT owl_variable *owl_variable_newvar(const char *name, const char *summary, const char *description)
     649{
    635650  owl_variable * var = g_new0(owl_variable, 1);
    636651  var->name = g_strdup(name);
     
    718733}
    719734
    720 void owl_variable_delete(owl_variable *v)
     735void owl_variable_cleanup(owl_variable *v)
    721736{
    722737  if (v->delete_fn) v->delete_fn(v);
     
    724739  g_free(v->summary);
    725740  g_free(v->description);
     741  if (v->type == OWL_VARIABLE_STRING)
     742    g_free(v->pval_default);
     743}
     744
     745void owl_variable_delete(owl_variable *v)
     746{
     747  owl_variable_cleanup(v);
    726748  g_free(v);
    727749}
     
    803825}
    804826
    805 char *owl_variable_get_tostring(const owl_vardict *d, const char *name) {
     827G_GNUC_WARN_UNUSED_RESULT char *owl_variable_get_tostring(const owl_vardict *d, const char *name)
     828{
    806829  owl_variable *v;
    807830  if (!name) return NULL;
     
    811834}
    812835
    813 char *owl_variable_get_default_tostring(const owl_vardict *d, const char *name) {
     836G_GNUC_WARN_UNUSED_RESULT char *owl_variable_get_default_tostring(const owl_vardict *d, const char *name)
     837{
    814838  owl_variable *v;
    815839  if (!name) return NULL;
     
    971995}
    972996
    973 char *owl_variable_bool_get_tostring_default(const owl_variable *v, const void *val) {
     997G_GNUC_WARN_UNUSED_RESULT char *owl_variable_bool_get_tostring_default(const owl_variable *v, const void *val)
     998{
    974999  if (val == NULL) {
    9751000    return g_strdup("<null>");
     
    10061031}
    10071032
    1008 char *owl_variable_int_get_tostring_default(const owl_variable *v, const void *val) {
     1033G_GNUC_WARN_UNUSED_RESULT char *owl_variable_int_get_tostring_default(const owl_variable *v, const void *val)
     1034{
    10091035  if (val == NULL) {
    10101036    return g_strdup("<null>");
     
    10451071}
    10461072
    1047 char *owl_variable_enum_get_tostring(const owl_variable *v, const void *val) {
     1073G_GNUC_WARN_UNUSED_RESULT char *owl_variable_enum_get_tostring(const owl_variable *v, const void *val)
     1074{
    10481075  char **enums;
    10491076  int nenums, i;
     
    10851112}
    10861113
    1087 char *owl_variable_string_get_tostring_default(const owl_variable *v, const void *val) {
     1114G_GNUC_WARN_UNUSED_RESULT char *owl_variable_string_get_tostring_default(const owl_variable *v, const void *val)
     1115{
    10881116  if (val == NULL) {
    10891117    return g_strdup("<null>");
  • viewwin.c

    r4fd211f rd427f08  
    1212 * will be used by the viewwin
    1313 */
    14 owl_viewwin *owl_viewwin_new_text(owl_window *win, const char *text)
     14G_GNUC_WARN_UNUSED_RESULT owl_viewwin *owl_viewwin_new_text(owl_window *win, const char *text)
    1515{
    1616  owl_viewwin *v = g_new0(owl_viewwin, 1);
     
    3434 * will be used by the viewwin
    3535 */
    36 owl_viewwin *owl_viewwin_new_fmtext(owl_window *win, const owl_fmtext *fmtext)
     36G_GNUC_WARN_UNUSED_RESULT owl_viewwin *owl_viewwin_new_fmtext(owl_window *win, const owl_fmtext *fmtext)
    3737{
    3838  char *text;
     
    237237}
    238238
    239 owl_editwin *owl_viewwin_set_typwin_active(owl_viewwin *v, owl_history *hist) {
     239G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_viewwin_set_typwin_active(owl_viewwin *v, owl_history *hist) {
    240240  int lines, cols;
    241241  owl_editwin *cmdline;
  • window.c

    rf97c1a6 rd427f08  
    569569};
    570570
    571 GSource *owl_window_redraw_source_new(void) {
     571G_GNUC_WARN_UNUSED_RESULT GSource *owl_window_redraw_source_new(void)
     572{
    572573  GSource *source;
    573574  source = g_source_new(&redraw_funcs, sizeof(GSource));
  • window.h

    r4cc49bc rfe73d0c  
    55#include <glib-object.h>
    66
    7 #ifdef HAVE_STDBOOL_H
    87#include <stdbool.h>
    9 #else
    10 #ifndef HAVE__BOOL
    11 #define _Bool signed char
    12 #endif
    13 #define bool _Bool
    14 #define false 0
    15 #define true 1
    16 #define __bool_true_false_are_defined 1
    17 #endif  /* HAVE_STDBOOL_H */
    188
    199G_BEGIN_DECLS
  • zcrypt.c

    r3b8a563 rd427f08  
    1111#include <unistd.h>
    1212#include <sys/types.h>
    13 #include <zephyr/zephyr.h>
    1413#include <glib.h>
    1514#include <string.h>
     
    5453} ZWRITEOPTIONS;
    5554
    56 char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance);
     55G_GNUC_WARN_UNUSED_RESULT char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance);
    5756int ParseCryptSpec(const char *spec, const char **keyfile);
    58 char *BuildArgString(char **argv, int start, int end);
    59 char *read_keystring(const char *keyfile);
     57G_GNUC_WARN_UNUSED_RESULT char *BuildArgString(char **argv, int start, int end);
     58G_GNUC_WARN_UNUSED_RESULT char *read_keystring(const char *keyfile);
    6059
    6160int do_encrypt(int zephyr, const char *class, const char *instance,
     
    365364/* Build a space-separated string from argv from elements between start  *
    366365 * and end - 1.  malloc()'s the returned string. */
    367 char *BuildArgString(char **argv, int start, int end)
     366G_GNUC_WARN_UNUSED_RESULT char *BuildArgString(char **argv, int start, int end)
    368367{
    369368  int len = 1;
     
    402401#define MAX_SEARCH 3
    403402/* Find the class/instance in the .crypt-table */
    404 char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance)
     403G_GNUC_WARN_UNUSED_RESULT char *GetZephyrVarKeyFile(const char *whoami, const char *class, const char *instance)
    405404{
    406405  char *keyfile = NULL;
     
    580579}
    581580
    582 char *slurp_stdin(int ignoredot, int *length) {
     581G_GNUC_WARN_UNUSED_RESULT char *slurp_stdin(int ignoredot, int *length) {
    583582  char *buf;
    584583  char *inptr;
     
    612611}
    613612
    614 char *GetInputBuffer(ZWRITEOPTIONS *zoptions, int *length) {
     613G_GNUC_WARN_UNUSED_RESULT char *GetInputBuffer(ZWRITEOPTIONS *zoptions, int *length) {
    615614  char *buf;
    616615
     
    638637}
    639638
    640 char *read_keystring(const char *keyfile) {
     639G_GNUC_WARN_UNUSED_RESULT char *read_keystring(const char *keyfile) {
    641640  char *keystring;
    642641  FILE *fkey = fopen(keyfile, "r");
  • zephyr.c

    rb848e30 rd427f08  
    4848  struct sockaddr_in sin;
    4949  ZNotice_t req;
     50  GIOChannel *channel;
    5051
    5152  /*
     
    9192  }
    9293
    93   owl_select_add_io_dispatch(ZGetFD(), OWL_IO_READ|OWL_IO_EXCEPT, &owl_zephyr_finish_initialization, NULL, NULL);
    94 }
    95 
    96 void owl_zephyr_finish_initialization(const owl_io_dispatch *d, void *data) {
     94  channel = g_io_channel_unix_new(ZGetFD());
     95  g_io_add_watch(channel, G_IO_IN | G_IO_ERR | G_IO_HUP,
     96                 &owl_zephyr_finish_initialization, NULL);
     97  g_io_channel_unref(channel);
     98}
     99
     100gboolean owl_zephyr_finish_initialization(GIOChannel *source, GIOCondition condition, void *data) {
    97101  Code_t code;
    98102  char *perl;
    99103  GSource *event_source;
    100104
    101   owl_select_remove_io_dispatch(d);
    102 
    103105  ZClosePort();
    104106
    105107  if ((code = ZInitialize()) != ZERR_NONE) {
    106108    owl_function_error("Initializing Zephyr: %s", error_message(code));
    107     return;
     109    return FALSE;
    108110  }
    109111
    110112  if ((code = ZOpenPort(NULL)) != ZERR_NONE) {
    111113    owl_function_error("Initializing Zephyr: %s", error_message(code));
    112     return;
     114    return FALSE;
    113115  }
    114116
     
    143145  perl = owl_perlconfig_execute("BarnOwl::Zephyr::_zephyr_startup()");
    144146  g_free(perl);
     147  return FALSE;
    145148}
    146149
     
    521524 */
    522525#ifdef HAVE_LIBZEPHYR
    523 char *owl_zephyr_get_field(const ZNotice_t *n, int j)
     526G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field(const ZNotice_t *n, int j)
    524527{
    525528  int i, count, save;
     
    549552}
    550553
    551 char *owl_zephyr_get_field_as_utf8(const ZNotice_t *n, int j)
     554G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field_as_utf8(const ZNotice_t *n, int j)
    552555{
    553556  int i, count, save;
     
    581584}
    582585#else
    583 char *owl_zephyr_get_field(void *n, int j)
     586G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field(void *n, int j)
    584587{
    585588  return(g_strdup(""));
    586589}
    587 char *owl_zephyr_get_field_as_utf8(void *n, int j)
     590G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_field_as_utf8(void *n, int j)
    588591{
    589592  return owl_zephyr_get_field(n, j);
     
    618621 * caller must free the return
    619622 */
    620 char *owl_zephyr_get_message(const ZNotice_t *n, const owl_message *m)
     623G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_get_message(const ZNotice_t *n, const owl_message *m)
    621624{
    622625#define OWL_NFIELDS     5
     
    939942#endif
    940943
    941 char *owl_zephyr_zlocate(const char *user, int auth)
     944G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_zlocate(const char *user, int auth)
    942945{
    943946#ifdef HAVE_LIBZEPHYR
     
    10391042
    10401043/* caller must free the return */
    1041 char *owl_zephyr_makesubline(const char *class, const char *inst, const char *recip)
     1044G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_makesubline(const char *class, const char *inst, const char *recip)
    10421045{
    10431046  return g_strdup_printf("%s,%s,%s\n", class, inst, !strcmp(recip, "") ? "*" : recip);
     
    11191122 * free the return.
    11201123 */
    1121 char *owl_zephyr_getsubs(void)
     1124G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_getsubs(void)
    11221125{
    11231126#ifdef HAVE_LIBZEPHYR
     
    12391242 * The caller must free the return
    12401243 */
    1241 char *short_zuser(const char *in)
     1244G_GNUC_WARN_UNUSED_RESULT char *short_zuser(const char *in)
    12421245{
    12431246  char *ptr = strrchr(in, '@');
     
    12511254 * The caller must free the return.
    12521255 */
    1253 char *long_zuser(const char *in)
     1256G_GNUC_WARN_UNUSED_RESULT char *long_zuser(const char *in)
    12541257{
    12551258  char *ptr = strrchr(in, '@');
     
    12791282 * caller must free the return.
    12801283 */
    1281 char *owl_zephyr_smartstripped_user(const char *in)
     1284G_GNUC_WARN_UNUSED_RESULT char *owl_zephyr_smartstripped_user(const char *in)
    12821285{
    12831286  char *slash, *dot, *realm, *out;
     
    14321435#endif
    14331436
    1434 void owl_zephyr_buddycheck_timer(owl_timer *t, void *data)
     1437gboolean owl_zephyr_buddycheck_timer(void *data)
    14351438{
    14361439  if (owl_global_is_pseudologins(&g)) {
     
    14401443    owl_function_debugmsg("Warning: owl_zephyr_buddycheck_timer call pointless; timer should have been disabled");
    14411444  }
     1445  return TRUE;
    14421446}
    14431447
     
    15101514  event_source = (owl_zephyr_event_source*) source;
    15111515  event_source->poll_fd.fd = fd;
    1512   event_source->poll_fd.events = G_IO_IN | G_IO_HUP | G_IO_PRI | G_IO_ERR;
     1516  event_source->poll_fd.events = G_IO_IN | G_IO_HUP | G_IO_ERR;
    15131517  g_source_add_poll(source, &event_source->poll_fd);
    15141518
  • zwrite.c

    r3b8a563 rd427f08  
    55#include "owl.h"
    66
    7 owl_zwrite *owl_zwrite_new(const char *line)
     7G_GNUC_WARN_UNUSED_RESULT owl_zwrite *owl_zwrite_new(const char *line)
    88{
    99  owl_zwrite *z = g_new(owl_zwrite, 1);
     
    1515}
    1616
    17 int owl_zwrite_create_from_line(owl_zwrite *z, const char *line)
     17G_GNUC_WARN_UNUSED_RESULT int owl_zwrite_create_from_line(owl_zwrite *z, const char *line)
    1818{
    1919  int argc, badargs, myargc;
     
    321321
    322322/* Caller must free the result. */
    323 char *owl_zwrite_get_recip_n_with_realm(const owl_zwrite *z, int n)
     323G_GNUC_WARN_UNUSED_RESULT char *owl_zwrite_get_recip_n_with_realm(const owl_zwrite *z, int n)
    324324{
    325325  if (z->realm[0]) {
     
    370370 * If not a CC, only the recip_index'th user will be replied to.
    371371 */
    372 char *owl_zwrite_get_replyline(const owl_zwrite *z, int recip_index)
     372G_GNUC_WARN_UNUSED_RESULT char *owl_zwrite_get_replyline(const owl_zwrite *z, int recip_index)
    373373{
    374374  /* Match ordering in zwrite help. */
Note: See TracChangeset for help on using the changeset viewer.