comparison libpurple/util.c @ 21621:b2aa68cdc8b9

I had used memcpy to copy the struct tm to where the caller wants it, but this assumes all callers provide their own allocated struct, which is not necessarily always the case. If callers want to keep the values of this struct tm across multiple calls to purple_str_to_time, they had better copy it themselves. (which is essentially the same as it was before when we were returning the pointer to the struct as returned by localtime(), which is also statically allocated)
author Stu Tomlinson <stu@nosnilmot.com>
date Fri, 23 Nov 2007 19:41:44 +0000
parents 31101e7d275f
children 8f82dc5e0b76
comparison
equal deleted inserted replaced
21618:85fc97ffe538 21621:b2aa68cdc8b9
895 } 895 }
896 } 896 }
897 897
898 if (tm != NULL) 898 if (tm != NULL)
899 { 899 {
900 memcpy(tm, &t, sizeof(struct tm)); 900 *tm = t;
901 tm->tm_isdst = -1; 901 tm->tm_isdst = -1;
902 mktime(tm); 902 mktime(tm);
903 } 903 }
904 904
905 retval = mktime(&t); 905 retval = mktime(&t);