Changeset d427f08 for commands.c


Ignore:
Timestamp:
Jun 22, 2011, 3:40:50 PM (13 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.8, release-1.9
Children:
b343c2c
Parents:
84a071f
git-author:
Jason Gross <jgross@mit.edu> (06/06/11 05:24:30)
git-committer:
Nelson Elhage <nelhage@mit.edu> (06/22/11 15:40:50)
Message:
Use G_GNUC_WARN_UNUSED_RESULT

Have gcc warn us when we ignore the result of a function that requires
the caller to free the result, or an initilization function that can
fail.  This might help (slightly) with preventing leaks and segfaults.

Additionally changed some functions that should never fail to not
return values.  (The owl_list_* functions changed only fail if
list->size < 0, which we assume is not the case elsewhere.)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    r58f4fb2 rd427f08  
    4141
    4242
    43 int owl_cmd_add_defaults(owl_cmddict *cd)
     43void owl_cmd_add_defaults(owl_cmddict *cd)
    4444{
    4545  owl_cmd commands_to_init[] = {
     
    10401040  };
    10411041
    1042   int ret = owl_cmddict_add_from_list(cd, commands_to_init);
     1042  owl_cmddict_add_from_list(cd, commands_to_init);
    10431043  owl_cmd *cmd;
    10441044  for (cmd = commands_to_init; cmd->name != NULL; cmd++)
    10451045    owl_cmd_cleanup(cmd);
    1046   return ret;
    10471046}
    10481047
     
    13741373}
    13751374
    1376 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)
    13771376{
    13781377  char *filtname = NULL;
     
    14141413}
    14151414
    1416 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)
    14171416{
    14181417  if(argc != 1)
     
    16451644
    16461645
    1647 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)
    16481647{
    16491648  return owl_function_exec(argc, argv, buff, OWL_OUTPUT_RETURN);
    16501649}
    16511650
    1652 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)
    16531652{
    16541653  return owl_function_exec(argc, argv, buff, OWL_OUTPUT_POPUP);
    16551654}
    16561655
    1657 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)
    16581657{
    16591658  return owl_function_exec(argc, argv, buff, OWL_OUTPUT_ADMINMSG);
    16601659}
    16611660
    1662 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)
    16631662{
    16641663  return owl_function_perl(argc, argv, buff, OWL_OUTPUT_RETURN);
    16651664}
    16661665
    1667 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)
    16681667{
    16691668  return owl_function_perl(argc, argv, buff, OWL_OUTPUT_POPUP);
    16701669}
    16711670
    1672 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)
    16731672{
    16741673  return owl_function_perl(argc, argv, buff, OWL_OUTPUT_ADMINMSG);
    16751674}
    16761675
    1677 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)
    16781677{
    16791678  char *lastrv = NULL, *newbuff;
     
    25952594}
    25962595
    2597 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)
    25982597{
    25992598  const char *stylename;
     
    26392638}
    26402639
    2641 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)
    26422641{
    26432642  owl_history *hist;
Note: See TracChangeset for help on using the changeset viewer.