Skip to content
Myr

jv_dtoa_tsd.c

This file

Path

src/jv_dtoa_tsd.c

52 lines · 1.3 KiB · C

Last changed by

Use jv_mem_alloc to allocate dtoa_context in tsd_dtoa_context_get (#3356)엄태용before adoption2e69879

History of this file

Take it

The walk stopped after 200 commits: lines older than fa6a2ff point at it.

website: remove unused root path on building website (#3248)itchynybefore adoptionfa6a2ff

lines 1–21why, one step back
1#include <stdlib.h>
2#include <stdio.h>34#include "jv_thread.h"5#include "jv_dtoa_tsd.h"6#include "jv_dtoa.h"7#include "jv_alloc.h"89static pthread_once_t dtoa_ctx_once = PTHREAD_ONCE_INIT;1011static pthread_key_t dtoa_ctx_key;12static void tsd_dtoa_ctx_dtor(void *ctx) {13 if (ctx) {14 jvp_dtoa_context_free((struct dtoa_context *)ctx);15 jv_mem_free(ctx);16 }17}1819#ifndef WIN3220static21#endif

Fix warning: a function definition without a prototype is deprecated (#3259)itchynybefore adoptiona8f27cc

line 22why, one step back
22void jv_tsd_dtoa_ctx_fini(void) {

website: remove unused root path on building website (#3248)itchynybefore adoptionfa6a2ff

lines 23–30why, one step back
23 struct dtoa_context *ctx = pthread_getspecific(dtoa_ctx_key);
24 tsd_dtoa_ctx_dtor(ctx);25 pthread_setspecific(dtoa_ctx_key, NULL);26}2728#ifndef WIN3229static30#endif

Fix warning: a function definition without a prototype is deprecated (#3259)itchynybefore adoptiona8f27cc

line 31why, one step back
31void jv_tsd_dtoa_ctx_init(void) {

website: remove unused root path on building website (#3248)itchynybefore adoptionfa6a2ff

lines 32–38why, one step back
32 if (pthread_key_create(&dtoa_ctx_key, tsd_dtoa_ctx_dtor) != 0) {
33 fprintf(stderr, "error: cannot create thread specific key");34 abort();35 }36 atexit(jv_tsd_dtoa_ctx_fini);37}38

Fix warning: a function definition without a prototype is deprecated (#3259)itchynybefore adoptiona8f27cc

line 39why, one step back
39inline struct dtoa_context *tsd_dtoa_context_get(void) {

website: remove unused root path on building website (#3248)itchynybefore adoptionfa6a2ff

lines 40–42why, one step back
40 pthread_once(&dtoa_ctx_once, jv_tsd_dtoa_ctx_init); // cannot fail
41 struct dtoa_context *ctx = (struct dtoa_context*)pthread_getspecific(dtoa_ctx_key);42 if (!ctx) {

Use jv_mem_alloc to allocate dtoa_context in tsd_dtoa_context_get (#3356)엄태용before adoption2e69879

line 43why, one step back
43 ctx = jv_mem_alloc(sizeof(struct dtoa_context));

website: remove unused root path on building website (#3248)itchynybefore adoptionfa6a2ff

lines 44–45why, one step back
44 jvp_dtoa_context_init(ctx);
45 if (pthread_setspecific(dtoa_ctx_key, ctx) != 0) {

Use jv_mem_alloc to allocate dtoa_context in tsd_dtoa_context_get (#3356)엄태용before adoption2e69879

line 46why, one step back
46 jv_mem_free(ctx);

website: remove unused root path on building website (#3248)itchynybefore adoptionfa6a2ff

lines 47–52why, one step back
47 fprintf(stderr, "error: cannot set thread specific data");
48 abort();49 }50 }51 return ctx;52}