Changeset d07af84 for keybinding.c


Ignore:
Timestamp:
Mar 24, 2011, 4:10:28 PM (13 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.8, release-1.9
Children:
47e0a6a
Parents:
45e2c95
git-author:
David Benjamin <davidben@mit.edu> (03/11/11 10:24:36)
git-committer:
David Benjamin <davidben@mit.edu> (03/24/11 16:10:28)
Message:
Clean up owl_keypress_tostring to return a newly-allocated string

I don't think it's possible to overflow the function's internal buffer,
but we may as well avoid this sketchiness.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • keybinding.c

    r45e2c95 rd07af84  
    8888{
    8989  GString *string;
    90   char keypress[64];  /* TODO: don't hard-code a value here. */
    9190  int  i;
    9291
    9392  string = g_string_new("");
    9493  for (i = 0; i < len; i++) {
    95     owl_keypress_tostring(j[i], 0, keypress, sizeof(keypress));
    96     g_string_append(string, keypress);
     94    char *keypress = owl_keypress_tostring(j[i], 0);
     95    g_string_append(string, keypress ? keypress : "INVALID");
     96    g_free(keypress);
    9797    if (i < len - 1) g_string_append_c(string, ' ');
    9898  }
Note: See TracChangeset for help on using the changeset viewer.