Changeset d275eb2 for keybinding.c


Ignore:
Timestamp:
Jan 2, 2011, 3:31:58 PM (11 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
2bc6ad35
Parents:
f640876
git-author:
David Benjamin <davidben@mit.edu> (12/15/10 13:18:34)
git-committer:
David Benjamin <davidben@mit.edu> (01/02/11 15:31:58)
Message:
Replace atokenize with glib's g_strsplit_set

Glib's had g_strsplit_set since forever, and it does exactly the same
thing as atokenize, modulo needing a pesky NULL check. We may as well
use it.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • keybinding.c

    r8a921b5 rd275eb2  
    3939  int    nktokens, i;
    4040
    41   ktokens = atokenize(keyseq, " ", &nktokens);
    42   if (!ktokens) return(-1);
    43   if (nktokens > OWL_KEYMAP_MAXSTACK) {
    44     atokenize_delete(ktokens, nktokens);
     41  ktokens = g_strsplit_set(keyseq, " ", 0);
     42  nktokens = g_strv_length(ktokens);
     43  if (nktokens < 1 || nktokens > OWL_KEYMAP_MAXSTACK) {
     44    g_strfreev(ktokens);
    4545    return(-1);
    4646  }
     
    4848  for (i=0; i<nktokens; i++) {
    4949    kb->keys[i] = owl_keypress_fromstring(ktokens[i]);
    50     if (kb->keys[i] == ERR) { 
    51       atokenize_delete(ktokens, nktokens);
     50    if (kb->keys[i] == ERR) {
     51      g_strfreev(ktokens);
    5252      owl_free(kb->keys);
    5353      return(-1);
     
    5555  }
    5656  kb->len = nktokens;
    57   atokenize_delete(ktokens, nktokens);
     57  g_strfreev(ktokens);
    5858  return(0);
    5959}
Note: See TracChangeset for help on using the changeset viewer.