Changeset c6c51d2


Ignore:
Timestamp:
May 18, 2011, 4:10:39 PM (13 years ago)
Author:
GitHub Merge Button <merge-button@github.com>
Parents:
7865479 (diff), 92fc397 (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 92fc39701adde0a4eb22ba7dad30e5d136fcc77c into 7865479440dd042766ecbbc1119b45e5eb7cd6a6
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • cmd.c

    r6a71113 r92fc397  
    1212
    1313int owl_cmddict_setup(owl_cmddict *cd) {
    14   if (0 != owl_cmddict_init(cd)) return(-1);
     14  owl_cmddict_init(cd);
    1515  if (0 != owl_cmddict_add_from_list(cd, commands_to_init)) return(-1);
    1616  return(0);
    1717}
    1818
    19 int owl_cmddict_init(owl_cmddict *cd) {
    20   if (owl_dict_create(cd)) return(-1);
    21   return(0);
     19void owl_cmddict_init(owl_cmddict *cd) {
     20  owl_dict_create(cd);
    2221}
    2322
     
    135134void owl_cmd_cleanup(owl_cmd *cmd)
    136135{
    137   if (cmd->name) g_free(cmd->name);
    138   if (cmd->summary) g_free(cmd->summary);
    139   if (cmd->usage) g_free(cmd->usage);
    140   if (cmd->description) g_free(cmd->description);
    141   if (cmd->cmd_aliased_to) g_free(cmd->cmd_aliased_to);
     136  g_free(cmd->name);
     137  g_free(cmd->summary);
     138  g_free(cmd->usage);
     139  g_free(cmd->description);
     140  g_free(cmd->cmd_aliased_to);
    142141  if (cmd->cmd_perl) owl_perlconfig_cmd_cleanup(cmd);
    143142}
  • commands.c

    rc809f5e r55b2de8  
    12881288  }
    12891289  owl_function_nextmsg_full(filter, skip_deleted, last_if_none);
    1290   if (filter) g_free(filter);
     1290  g_free(filter);
    12911291  return(NULL);
    12921292}
     
    13181318  }
    13191319  owl_function_prevmsg_full(filter, skip_deleted, first_if_none);
    1320   if (filter) g_free(filter);
     1320  g_free(filter);
    13211321  return(NULL);
    13221322}
     
    16911691  commands = g_strsplit_set(newbuff, ";", 0);
    16921692  for (i = 0; commands[i] != NULL; i++) {
    1693     if (lastrv) {
    1694       g_free(lastrv);
    1695     }
     1693    g_free(lastrv);
    16961694    lastrv = owl_function_command(commands[i]);
    16971695  }
  • dict.c

    rf25df21 r92fc397  
    1515#define GROWBY 3 / 2
    1616
    17 int owl_dict_create(owl_dict *d) {
     17void owl_dict_create(owl_dict *d) {
    1818  d->size=0;
    1919  d->els=g_new(owl_dict_el, INITSIZE);
    2020  d->avail=INITSIZE;
    21   if (d->els==NULL) return(-1);
    22   return(0);
    2321}
    2422
     
    6058/* Appends dictionary keys to a list.  Duplicates the keys,
    6159 * so they will need to be freed by the caller. */
    62 int owl_dict_get_keys(const owl_dict *d, owl_list *l) {
     60void owl_dict_get_keys(const owl_dict *d, owl_list *l) {
    6361  int i;
    64   char *dupk;
    6562  for (i=0; i<d->size; i++) {
    66     if ((dupk = g_strdup(d->els[i].k)) == NULL) return(-1);
    67     owl_list_append_element(l, dupk);
     63    owl_list_append_element(l, g_strdup(d->els[i].k));
    6864  }
    69   return(0);
    7065}
    7166
     
    8479{
    8580  int pos, found;
    86   char *dupk;
    8781  found = _owl_dict_find_pos(d, k, &pos);
    8882  if (found && delete_on_replace) {
     
    9993      if (d->els==NULL) return(-1);
    10094    }
    101     if ((dupk = g_strdup(k)) == NULL) return(-1);
    10295    if (pos!=d->size) {
    10396      /* shift forward to leave us a slot */
     
    10699    }
    107100    d->size++;
    108     d->els[pos].k = dupk;
     101    d->els[pos].k = g_strdup(k);
    109102    d->els[pos].v = v;   
    110103    return(0);
  • editwin.c

    r47e0a6a r55b2de8  
    317317  }
    318318
    319   if (locktext)
    320     g_free(locktext);
     319  g_free(locktext);
    321320
    322321  oe_set_index(e, lock);
  • functions.c

    r7865479 rc6c51d2  
    3232  char *rv;
    3333  rv=owl_function_command(cmdbuff);
    34   if (rv) g_free(rv);
     34  g_free(rv);
    3535}
    3636
     
    453453
    454454  if (rv || status) {
    455     if(cryptmsg) g_free(cryptmsg);
     455    g_free(cryptmsg);
    456456    g_free(old_msg);
    457457    owl_function_error("Error in zcrypt, possibly no key found.  Message not sent.");
     
    991991  /* execute the commands in shutdown */
    992992  ret = owl_perlconfig_execute("BarnOwl::Hooks::_shutdown();");
    993   if (ret) g_free(ret);
     993  g_free(ret);
    994994
    995995  /* signal our child process, if any */
     
    23582358done:
    23592359  g_free(class);
    2360   if (instance) {
    2361     g_free(instance);
    2362   }
     2360  g_free(instance);
    23632361  return(filtname);
    23642362}
  • global.c

    r7b4f3be rc72f884  
    505505
    506506void owl_global_set_startupargs(owl_global *g, int argc, char **argv) {
    507   if (g->startupargs) g_free(g->startupargs);
     507  g_free(g->startupargs);
    508508  g->startupargs = g_strjoinv(" ", argv);
    509509}
     
    747747}
    748748
    749 int owl_global_get_style_names(const owl_global *g, owl_list *l) {
    750   return owl_dict_get_keys(&(g->styledict), l);
     749void owl_global_get_style_names(const owl_global *g, owl_list *l) {
     750  owl_dict_get_keys(&(g->styledict), l);
    751751}
    752752
  • keybinding.c

    rd07af84 r55b2de8  
    6969void owl_keybinding_delete(owl_keybinding *kb)
    7070{
    71   if (kb->keys) g_free(kb->keys);
    72   if (kb->desc) g_free(kb->desc);
    73   if (kb->command) g_free(kb->command);
     71  g_free(kb->keys);
     72  g_free(kb->desc);
     73  g_free(kb->command);
    7474  g_free(kb);
    7575}
  • keymap.c

    r47e0a6a r92fc397  
    99{
    1010  if (!name || !desc) return(-1);
    11   if ((km->name = g_strdup(name)) == NULL) return(-1);
    12   if ((km->desc = g_strdup(desc)) == NULL) return(-1);
    13   if (0 != owl_list_create(&km->bindings)) return(-1);
     11  km->name = g_strdup(name);
     12  km->desc = g_strdup(desc);
     13  owl_list_create(&km->bindings);
    1414  km->parent = NULL;
    1515  km->default_fn = default_fn;
     
    179179/* NOTE: keyhandler has private access to the internals of keymap */
    180180
    181 int owl_keyhandler_init(owl_keyhandler *kh)
    182 {
    183   if (0 != owl_dict_create(&kh->keymaps)) return(-1);
     181void owl_keyhandler_init(owl_keyhandler *kh)
     182{
     183  owl_dict_create(&kh->keymaps);
    184184  kh->active = NULL;
    185185  owl_keyhandler_reset(kh);
    186   return(0);
    187186}
    188187
  • list.c

    rddbbcffa r7fd0bf7  
    55#define GROWBY 3 / 2
    66
    7 int owl_list_create(owl_list *l)
     7void owl_list_create(owl_list *l)
    88{
    99  l->size=0;
    1010  l->list=g_new(void *, INITSIZE);
    1111  l->avail=INITSIZE;
    12   if (l->list==NULL) return(-1);
    13   return(0);
    1412}
    1513
  • owl.c

    r9efa5bd r55b2de8  
    552552  owl_function_debugmsg("startup: executing perl startup, if applicable");
    553553  perlout = owl_perlconfig_execute("BarnOwl::Hooks::_startup();");
    554   if (perlout) g_free(perlout);
     554  g_free(perlout);
    555555
    556556  /* welcome message */
  • perlconfig.c

    rf2d71cfa r55b2de8  
    467467                                           :"BarnOwl::_receive_msg_legacy_wrap", m);
    468468  }
    469   if (ptr) g_free(ptr);
     469  g_free(ptr);
    470470}
    471471
     
    478478                                           :"BarnOwl::Hooks::_new_msg", m);
    479479  }
    480   if (ptr) g_free(ptr);
     480  g_free(ptr);
    481481}
    482482
  • perlglue.xs

    r6a71113 r55b2de8  
    5757                RETVAL
    5858        CLEANUP:
    59                 if (rv) g_free(rv);
     59                g_free(rv);
    6060
    6161SV *
     
    114114                RETVAL
    115115        CLEANUP:
    116                 if (rv) g_free(rv);
     116                g_free(rv);
    117117
    118118const utf8 *
     
    141141                RETVAL
    142142    CLEANUP:
    143                 if (rv) g_free(rv);
     143                g_free(rv);
    144144
    145145void
     
    324324                RETVAL
    325325        CLEANUP:
    326                 if (rv)
    327                         g_free(rv);
     326                g_free(rv);
    328327
    329328void
  • tester.c

    rf25df21 r92fc397  
    233233
    234234  printf("# BEGIN testing owl_dict\n");
    235   FAIL_UNLESS("create", 0==owl_dict_create(&d));
     235  owl_dict_create(&d);
    236236  FAIL_UNLESS("insert b", 0==owl_dict_insert_element(&d, "b", bv, owl_dict_noop_delete));
    237237  FAIL_UNLESS("insert d", 0==owl_dict_insert_element(&d, "d", dv, owl_dict_noop_delete));
     
    249249  FAIL_UNLESS("get_size", 3==owl_dict_get_size(&d));
    250250  owl_list_create(&l);
    251   FAIL_UNLESS("get_keys", 0==owl_dict_get_keys(&d, &l));
     251  owl_dict_get_keys(&d, &l);
    252252  FAIL_UNLESS("get_keys result size", 3==owl_list_get_size(&l));
    253253 
  • variable.c

    rf203cad r92fc397  
    559559int owl_variable_dict_setup(owl_vardict *vd) {
    560560  owl_variable *var, *cur;
    561   if (owl_dict_create(vd)) return(-1);
     561  owl_dict_create(vd);
    562562  for (var = variables_to_init; var->name != NULL; var++) {
    563563    cur = g_new(owl_variable, 1);
     
    641641
    642642void owl_variable_update(owl_variable *var, const char *summary, const char *desc) {
    643   if(var->summary) g_free(var->summary);
     643  g_free(var->summary);
    644644  var->summary = g_strdup(summary);
    645   if(var->description) g_free(var->description);
     645  g_free(var->description);
    646646  var->description = g_strdup(desc);
    647647}
     
    651651  if(old) {
    652652    owl_variable_update(old, summ, desc);
    653     if(old->pval_default) g_free(old->pval_default);
     653    g_free(old->pval_default);
    654654    old->pval_default = g_strdup(initval);
    655655  } else {
     
    944944void owl_variable_delete_default(owl_variable *v)
    945945{
    946   if (v->val) g_free(v->val);
     946  g_free(v->val);
    947947}
    948948
     
    10761076    if (!v->validate_fn(v, newval)) return(-1);
    10771077  }
    1078   if (v->val) g_free(v->val);
     1078  g_free(v->val);
    10791079  v->val = g_strdup(newval);
    10801080  return(0);
  • view.c

    rd4927a7 r55b2de8  
    160160{
    161161  owl_list_cleanup(&v->ml.list, NULL);
    162   if (v->name) g_free(v->name);
     162  g_free(v->name);
    163163}
  • zcrypt.c

    r1dd285b r55b2de8  
    476476
    477477  for(i = 0; i < MAX_SEARCH; i++) {
    478     if(varname[i] != NULL) {
    479       g_free(varname[i]);
    480     }
    481   }
    482 
    483   if(filename != NULL) {
    484     g_free(filename);
    485   }
     478    g_free(varname[i]);
     479  }
     480
     481  g_free(filename);
    486482
    487483  return keyfile;
     
    773769  err = call_filter("gpg", argv, in, &out, &status);
    774770  if(err || status) {
    775     if(out) g_free(out);
     771    g_free(out);
    776772    return FALSE;
    777773  }
     
    856852  err = call_filter("gpg", argv, in, &out, &status);
    857853  if(err || status) {
    858     if(out) g_free(out);
     854    g_free(out);
    859855    return FALSE;
    860856  }
  • zephyr.c

    rf203cad r55b2de8  
    417417    return 0;
    418418  }
    419   if (buffer)
    420     g_free(buffer);
     419  g_free(buffer);
    421420
    422421  return owl_zephyr_loadsubs_helper(subs, count);
  • zwrite.c

    r3f52e14 r55b2de8  
    185185void owl_zwrite_set_message_raw(owl_zwrite *z, const char *msg)
    186186{
    187   if (z->message) g_free(z->message);
     187  g_free(z->message);
    188188  z->message = owl_validate_utf8(msg);
    189189}
     
    195195  char *tmp = NULL, *tmp2;
    196196
    197   if (z->message) g_free(z->message);
     197  g_free(z->message);
    198198
    199199  j=owl_list_get_size(&(z->recips));
     
    289289void owl_zwrite_set_opcode(owl_zwrite *z, const char *opcode)
    290290{
    291   if (z->opcode) g_free(z->opcode);
     291  g_free(z->opcode);
    292292  z->opcode=owl_validate_utf8(opcode);
    293293}
     
    306306void owl_zwrite_set_zsig(owl_zwrite *z, const char *zsig)
    307307{
    308   if(z->zsig) g_free(z->zsig);
     308  g_free(z->zsig);
    309309  z->zsig = g_strdup(zsig);
    310310}
     
    353353{
    354354  owl_list_cleanup(&(z->recips), &g_free);
    355   if (z->cmd) g_free(z->cmd);
    356   if (z->zwriteline) g_free(z->zwriteline);
    357   if (z->class) g_free(z->class);
    358   if (z->inst) g_free(z->inst);
    359   if (z->opcode) g_free(z->opcode);
    360   if (z->realm) g_free(z->realm);
    361   if (z->message) g_free(z->message);
    362   if (z->zsig) g_free(z->zsig);
     355  g_free(z->cmd);
     356  g_free(z->zwriteline);
     357  g_free(z->class);
     358  g_free(z->inst);
     359  g_free(z->opcode);
     360  g_free(z->realm);
     361  g_free(z->message);
     362  g_free(z->zsig);
    363363}
    364364
  • configure.ac

    r4479497 r64c829a  
    115115
    116116dnl Add CFLAGS and LIBS for glib-2.0
    117 PKG_CHECK_MODULES(GLIB,[glib-2.0 gobject-2.0])
     117PKG_CHECK_MODULES(GLIB,[glib-2.0 >= 2.12 gobject-2.0])
    118118
    119119AC_MSG_NOTICE([Adding glib-2.0 CFLAGS ${GLIB_CFLAGS}])
  • logging.c

    rfe3b017 r7865479  
    151151  } else if (owl_message_is_type_jabber(m)) {
    152152    to = g_strdup_printf("jabber:%s", owl_message_get_recipient(m));
    153     owl_text_tr(to, '/', '_');
     153    g_strdelimit(to, "/", '_');
    154154  } else if (owl_message_is_type_aim(m)) {
    155155    char *temp2;
  • owl.h

    r7b4f3be rede073c  
    6666#include "window.h"
    6767
     68#ifndef OWL_VERSION_STRING
    6869#ifdef  GIT_VERSION
    6970#define stringify(x)       __stringify(x)
     
    7374#define OWL_VERSION_STRING PACKAGE_VERSION
    7475#endif
     76#endif /* !OWL_VERSION_STRING */
    7577
    7678/* Feature that is being tested to redirect stderr through a pipe.
  • text.c

    r42ee1be r7865479  
    275275  g_strfreev(split);
    276276  return out;
    277 }
    278 
    279 /* replace all instances of character a in buff with the character
    280  * b.  buff must be null terminated.
    281  */
    282 void owl_text_tr(char *buff, char a, char b)
    283 {
    284   int i;
    285 
    286   owl_function_debugmsg("In: %s", buff);
    287   for (i=0; buff[i]!='\0'; i++) {
    288     if (buff[i]==a) buff[i]=b;
    289   }
    290   owl_function_debugmsg("Out: %s", buff);
    291277}
    292278
Note: See TracChangeset for help on using the changeset viewer.