Changeset d427f08 for perlconfig.c


Ignore:
Timestamp:
Jun 22, 2011, 3:40:50 PM (10 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, 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
  • perlconfig.c

    rbcde7926 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;
     
    251251/* Calls in a scalar context, passing it a hash reference.
    252252   If return value is non-null, caller must free. */
    253 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)
    254254{
    255255  dSP ;
     
    300300   If the return value is non-null, the caller must free it.
    301301 */
    302 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)
    303303{
    304304  dSP;
     
    349349}
    350350
    351 
    352 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)
    353353{
    354354  int ret;
     
    436436
    437437/* caller is responsible for freeing returned string */
    438 char *owl_perlconfig_execute(const char *line)
     438G_GNUC_WARN_UNUSED_RESULT char *owl_perlconfig_execute(const char *line)
    439439{
    440440  STRLEN len;
     
    505505}
    506506
    507 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)
    508509{
    509510  int i, count;
Note: See TracChangeset for help on using the changeset viewer.