- Timestamp:
- Oct 8, 2017, 6:02:19 PM (7 years ago)
- Branches:
- master
- Children:
- 4fd3c04
- Parents:
- 09530e6
- git-author:
- Anders Kaseorg <andersk@mit.edu> (10/07/17 03:25:44)
- git-committer:
- Anders Kaseorg <andersk@mit.edu> (10/08/17 18:02:19)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
message.c
rff528e6 ree6b30f 30 30 void owl_message_init(owl_message *m) 31 31 { 32 /* ctime_r requires a 26-byte buffer */ 33 char timestr[26]; 34 32 35 m->id=owl_global_get_nextmsgid(&g); 33 36 owl_message_set_direction_none(m); … … 43 46 /* save the time */ 44 47 m->time = time(NULL); 45 m->timestr = g_strdup(ctime(&m->time));46 m->timestr [strlen(m->timestr)-1] = '\0';48 ctime_r(&m->time, timestr); 49 m->timestr = g_strndup(timestr, strlen(timestr) - 1); 47 50 48 51 m->fmtext = NULL; … … 349 352 CALLER_OWN char *owl_message_format_time(const owl_message *m) 350 353 { 351 return owl_util_format_time(localtime(&m->time)); 354 struct tm tm; 355 return owl_util_format_time(localtime_r(&m->time, &tm)); 352 356 } 353 357 … … 593 597 CALLER_OWN GList *owl_message_get_cc_without_recipient(const owl_message *m) 594 598 { 595 char *cc, *shortuser, *recip ;599 char *cc, *shortuser, *recip, *saveptr; 596 600 const char *user; 597 601 GList *out = NULL; … … 603 607 recip = short_zuser(owl_message_get_recipient(m)); 604 608 605 user = strtok (cc, " ");609 user = strtok_r(cc, " ", &saveptr); 606 610 while (user != NULL) { 607 611 shortuser = short_zuser(user); … … 610 614 } 611 615 g_free(shortuser); 612 user = strtok (NULL, " ");616 user = strtok_r(NULL, " ", &saveptr); 613 617 } 614 618 … … 775 779 struct hostent *hent; 776 780 #endif /* ZNOTICE_SOCKADDR */ 777 char *tmp, *tmp2; 781 /* ctime_r requires a 26-byte buffer */ 782 char timestr[26], *tmp, *tmp2; 778 783 int len; 779 784 … … 793 798 if (m->timestr) g_free(m->timestr); 794 799 m->time = n->z_time.tv_sec; 795 m->timestr = g_strdup(ctime(&m->time));796 m->timestr [strlen(m->timestr)-1] = '\0';800 ctime_r(&m->time, timestr); 801 m->timestr = g_strndup(timestr, strlen(timestr) - 1); 797 802 798 803 /* set other info */
Note: See TracChangeset
for help on using the changeset viewer.