IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41468 for trunk


Ignore:
Timestamp:
Jan 12, 2021, 4:15:16 PM (6 years ago)
Author:
eugene
Message:

cleanly handle invalid dates; free error lines

Location:
trunk/Ohana/src/libohana
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libohana/include/ohana.h

    r41341 r41468  
    415415int    push_error                PROTO((char *line));
    416416int    print_error               PROTO((void));
     417void   free_error                PROTO(());
    417418
    418419// gprint gets a stub implementation in libohana. opihi implements the real one.
  • trunk/Ohana/src/libohana/src/errors.c

    r40328 r41468  
    5151  return (TRUE);
    5252}
     53
     54void free_error() {
     55  for (int i = 0; i < Nline; i++) {
     56    FREE (errorlines[i]);
     57  }
     58  FREE (errorlines);
     59}
  • trunk/Ohana/src/libohana/src/time.c

    r38553 r41468  
    251251  ALLOCATE (line, char, 64);
    252252  gmt   = gmtime (&second);
    253   snprintf (line, 64, "%04d/%02d/%02d,%02d:%02d:%02d", 1900 + gmt[0].tm_year, gmt[0].tm_mon+1, gmt[0].tm_mday, gmt[0].tm_hour, gmt[0].tm_min, gmt[0].tm_sec);
     253  if (!gmt) {
     254    snprintf (line, 64, "INVALID DATE");
     255  } else {
     256    snprintf (line, 64, "%04d/%02d/%02d,%02d:%02d:%02d", 1900 + gmt[0].tm_year, gmt[0].tm_mon+1, gmt[0].tm_mday, gmt[0].tm_hour, gmt[0].tm_min, gmt[0].tm_sec);
     257  }
    254258  return (line);
    255259
Note: See TracChangeset for help on using the changeset viewer.