diff options
author | John-Mark Bell <jmb@netsurf-browser.org> | 2024-03-05 22:34:35 +0000 |
---|---|---|
committer | John-Mark Bell <jmb@netsurf-browser.org> | 2024-03-05 22:34:35 +0000 |
commit | 4b937dc315ba1c326d2adebe0ca8d210c3954313 (patch) | |
tree | 3aa39cf29ddd4ca2fecc794049114342b0f8cafa | |
parent | 167676c335a517333005b59746006b4fccd45af5 (diff) | |
download | netsurf-4b937dc315ba1c326d2adebe0ca8d210c3954313.tar.gz netsurf-4b937dc315ba1c326d2adebe0ca8d210c3954313.tar.bz2 |
Cookie/History/Hotlist: use localtime()
Some platforms do not support the reentrant form, so don't use it.
-rw-r--r-- | desktop/cookie_manager.c | 6 | ||||
-rw-r--r-- | desktop/global_history.c | 6 | ||||
-rw-r--r-- | desktop/hotlist.c | 6 |
3 files changed, 9 insertions, 9 deletions
diff --git a/desktop/cookie_manager.c b/desktop/cookie_manager.c index 7cb93dff7..b5ec89618 100644 --- a/desktop/cookie_manager.c +++ b/desktop/cookie_manager.c @@ -242,19 +242,19 @@ cookie_manager_field_builder_time(enum cookie_manager_field field, struct treeview_field_data *fdata, const time_t *value) { - struct tm ftime; + struct tm *ftime; fdata->field = cm_ctx.fields[field].field; fdata->value = NULL; fdata->value_len = 0; - if (localtime_r(value, &ftime) != NULL) { + if ((ftime = localtime(value)) != NULL) { const size_t vsize = 256; char *value = malloc(vsize); if (value != NULL) { fdata->value = value; fdata->value_len = strftime(value, vsize, - "%a %b %e %H:%M:%S %Y", &ftime); + "%a %b %e %H:%M:%S %Y", ftime); } } diff --git a/desktop/global_history.c b/desktop/global_history.c index 5d13971bb..e98e4cb29 100644 --- a/desktop/global_history.c +++ b/desktop/global_history.c @@ -266,7 +266,7 @@ static nserror global_history_create_treeview_field_data( const char *title = (data->title != NULL) ? data->title : messages_get("NoTitle"); char buffer[16]; - struct tm lvtime; + struct tm *lvtime; char *last_visited = NULL; size_t len = 0; @@ -279,12 +279,12 @@ static nserror global_history_create_treeview_field_data( e->data[GH_URL].value = nsurl_access(e->url); e->data[GH_URL].value_len = nsurl_length(e->url); - if (localtime_r(&data->last_visit, &lvtime) != NULL) { + if ((lvtime = localtime(&data->last_visit)) != NULL) { const size_t lvsize = 256; last_visited = malloc(lvsize); if (last_visited != NULL) { len = strftime(last_visited, lvsize, - "%a %b %e %H:%M:%S %Y", &lvtime); + "%a %b %e %H:%M:%S %Y", lvtime); } } diff --git a/desktop/hotlist.c b/desktop/hotlist.c index 4f3ca77e1..20c0890a1 100644 --- a/desktop/hotlist.c +++ b/desktop/hotlist.c @@ -199,14 +199,14 @@ static nserror hotlist_create_treeview_field_visits_data( /* Last visited */ if (data->visits != 0) { const size_t lvsize = 256; - struct tm lvtime; + struct tm *lvtime; - if (localtime_r(&data->last_visit, &lvtime) != NULL) { + if ((lvtime = localtime(&data->last_visit)) != NULL) { last_visited = malloc(lvsize); if (last_visited != NULL) { len = strftime(last_visited, lvsize, "%a %b %e %H:%M:%S %Y", - &lvtime); + lvtime); } } } else { |