Skip to content

Commit 6a2acd6

Browse files
committed
Remove protos and folding marks from .c files
1 parent b56f203 commit 6a2acd6

File tree

437 files changed

+10521
-22719
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

437 files changed

+10521
-22719
lines changed

TSRM/TSRM.c

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ TSRM_TLS uint8_t is_thread_shutdown = 0;
117117

118118
/* Startup TSRM (call once for the entire process) */
119119
TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_level, char *debug_filename)
120-
{/*{{{*/
120+
{
121121
#if defined(TSRM_WIN32)
122122
tls_key = TlsAlloc();
123123
#else
@@ -159,12 +159,12 @@ TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debu
159159
tsrm_env_mutex = tsrm_mutex_alloc();
160160

161161
return 1;
162-
}/*}}}*/
162+
}
163163

164164

165165
/* Shutdown TSRM (call once for the entire process) */
166166
TSRM_API void tsrm_shutdown(void)
167-
{/*{{{*/
167+
{
168168
int i;
169169

170170
if (is_thread_shutdown) {
@@ -224,21 +224,21 @@ TSRM_API void tsrm_shutdown(void)
224224

225225
tsrm_reserved_pos = 0;
226226
tsrm_reserved_size = 0;
227-
}/*}}}*/
227+
}
228228

229-
/* {{{ */
229+
/* */
230230
/* environ lock api */
231231
TSRM_API void tsrm_env_lock() {
232232
tsrm_mutex_lock(tsrm_env_mutex);
233233
}
234234

235235
TSRM_API void tsrm_env_unlock() {
236236
tsrm_mutex_unlock(tsrm_env_mutex);
237-
} /* }}} */
237+
}
238238

239239
/* enlarge the arrays for the already active threads */
240240
static void tsrm_update_active_threads(void)
241-
{/*{{{*/
241+
{
242242
int i;
243243

244244
for (i=0; i<tsrm_tls_table_size; i++) {
@@ -264,12 +264,12 @@ static void tsrm_update_active_threads(void)
264264
p = p->next;
265265
}
266266
}
267-
}/*}}}*/
267+
}
268268

269269

270270
/* allocates a new thread-safe-resource id */
271271
TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor)
272-
{/*{{{*/
272+
{
273273
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Obtaining a new resource id, %d bytes", size));
274274

275275
tsrm_mutex_lock(tsmm_mutex);
@@ -302,20 +302,20 @@ TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate
302302

303303
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Successfully allocated new resource id %d", *rsrc_id));
304304
return *rsrc_id;
305-
}/*}}}*/
305+
}
306306

307307

308308
/* Reserve space for fast thread-safe-resources */
309309
TSRM_API void tsrm_reserve(size_t size)
310-
{/*{{{*/
310+
{
311311
tsrm_reserved_pos = 0;
312312
tsrm_reserved_size = TSRM_ALIGNED_SIZE(size);
313-
}/*}}}*/
313+
}
314314

315315

316316
/* allocates a new fast thread-safe-resource id */
317317
TSRM_API ts_rsrc_id ts_allocate_fast_id(ts_rsrc_id *rsrc_id, size_t *offset, size_t size, ts_allocate_ctor ctor, ts_allocate_dtor dtor)
318-
{/*{{{*/
318+
{
319319
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Obtaining a new fast resource id, %d bytes", size));
320320

321321
tsrm_mutex_lock(tsmm_mutex);
@@ -360,11 +360,11 @@ TSRM_API ts_rsrc_id ts_allocate_fast_id(ts_rsrc_id *rsrc_id, size_t *offset, siz
360360

361361
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Successfully allocated new resource id %d", *rsrc_id));
362362
return *rsrc_id;
363-
}/*}}}*/
363+
}
364364

365365

366366
static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_T thread_id)
367-
{/*{{{*/
367+
{
368368
int i;
369369

370370
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Creating data structures for thread %x", thread_id));
@@ -404,12 +404,12 @@ static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_
404404
}
405405

406406
tsrm_mutex_unlock(tsmm_mutex);
407-
}/*}}}*/
407+
}
408408

409409

410410
/* fetches the requested resource for the current thread */
411411
TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id)
412-
{/*{{{*/
412+
{
413413
THREAD_T thread_id;
414414
int hash_value;
415415
tsrm_tls_entry *thread_resources;
@@ -467,12 +467,12 @@ TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id)
467467
* changes to the structure as we read it.
468468
*/
469469
TSRM_SAFE_RETURN_RSRC(thread_resources->storage, id, thread_resources->count);
470-
}/*}}}*/
470+
}
471471

472472

473473
/* frees all resources allocated for the current thread */
474474
void ts_free_thread(void)
475-
{/*{{{*/
475+
{
476476
tsrm_tls_entry *thread_resources;
477477
int i;
478478
THREAD_T thread_id = tsrm_thread_id();
@@ -513,11 +513,11 @@ void ts_free_thread(void)
513513
thread_resources = thread_resources->next;
514514
}
515515
tsrm_mutex_unlock(tsmm_mutex);
516-
}/*}}}*/
516+
}
517517

518518
/* deallocates all occurrences of a given id */
519519
void ts_free_id(ts_rsrc_id id)
520-
{/*{{{*/
520+
{
521521
int i;
522522
int j = TSRM_UNSHUFFLE_RSRC_ID(id);
523523

@@ -548,7 +548,7 @@ void ts_free_id(ts_rsrc_id id)
548548
tsrm_mutex_unlock(tsmm_mutex);
549549

550550
TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Successfully freed resource id %d", id));
551-
}/*}}}*/
551+
}
552552

553553

554554
/*
@@ -557,18 +557,18 @@ void ts_free_id(ts_rsrc_id id)
557557

558558
/* Obtain the current thread id */
559559
TSRM_API THREAD_T tsrm_thread_id(void)
560-
{/*{{{*/
560+
{
561561
#ifdef TSRM_WIN32
562562
return GetCurrentThreadId();
563563
#else
564564
return pthread_self();
565565
#endif
566-
}/*}}}*/
566+
}
567567

568568

569569
/* Allocate a mutex */
570570
TSRM_API MUTEX_T tsrm_mutex_alloc(void)
571-
{/*{{{*/
571+
{
572572
MUTEX_T mutexp;
573573
#ifdef TSRM_WIN32
574574
mutexp = malloc(sizeof(CRITICAL_SECTION));
@@ -581,12 +581,12 @@ TSRM_API MUTEX_T tsrm_mutex_alloc(void)
581581
printf("Mutex created thread: %d\n",mythreadid());
582582
#endif
583583
return( mutexp );
584-
}/*}}}*/
584+
}
585585

586586

587587
/* Free a mutex */
588588
TSRM_API void tsrm_mutex_free(MUTEX_T mutexp)
589-
{/*{{{*/
589+
{
590590
if (mutexp) {
591591
#ifdef TSRM_WIN32
592592
DeleteCriticalSection(mutexp);
@@ -599,78 +599,78 @@ TSRM_API void tsrm_mutex_free(MUTEX_T mutexp)
599599
#ifdef THR_DEBUG
600600
printf("Mutex freed thread: %d\n",mythreadid());
601601
#endif
602-
}/*}}}*/
602+
}
603603

604604

605605
/*
606606
Lock a mutex.
607607
A return value of 0 indicates success
608608
*/
609609
TSRM_API int tsrm_mutex_lock(MUTEX_T mutexp)
610-
{/*{{{*/
610+
{
611611
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Mutex locked thread: %ld", tsrm_thread_id()));
612612
#ifdef TSRM_WIN32
613613
EnterCriticalSection(mutexp);
614614
return 0;
615615
#else
616616
return pthread_mutex_lock(mutexp);
617617
#endif
618-
}/*}}}*/
618+
}
619619

620620

621621
/*
622622
Unlock a mutex.
623623
A return value of 0 indicates success
624624
*/
625625
TSRM_API int tsrm_mutex_unlock(MUTEX_T mutexp)
626-
{/*{{{*/
626+
{
627627
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Mutex unlocked thread: %ld", tsrm_thread_id()));
628628
#ifdef TSRM_WIN32
629629
LeaveCriticalSection(mutexp);
630630
return 0;
631631
#else
632632
return pthread_mutex_unlock(mutexp);
633633
#endif
634-
}/*}}}*/
634+
}
635635

636636
/*
637637
Changes the signal mask of the calling thread
638638
*/
639639
#ifdef HAVE_SIGPROCMASK
640640
TSRM_API int tsrm_sigmask(int how, const sigset_t *set, sigset_t *oldset)
641-
{/*{{{*/
641+
{
642642
TSRM_ERROR((TSRM_ERROR_LEVEL_INFO, "Changed sigmask in thread: %ld", tsrm_thread_id()));
643643

644644
return pthread_sigmask(how, set, oldset);
645-
}/*}}}*/
645+
}
646646
#endif
647647

648648

649649
TSRM_API void *tsrm_set_new_thread_begin_handler(tsrm_thread_begin_func_t new_thread_begin_handler)
650-
{/*{{{*/
650+
{
651651
void *retval = (void *) tsrm_new_thread_begin_handler;
652652

653653
tsrm_new_thread_begin_handler = new_thread_begin_handler;
654654
return retval;
655-
}/*}}}*/
655+
}
656656

657657

658658
TSRM_API void *tsrm_set_new_thread_end_handler(tsrm_thread_end_func_t new_thread_end_handler)
659-
{/*{{{*/
659+
{
660660
void *retval = (void *) tsrm_new_thread_end_handler;
661661

662662
tsrm_new_thread_end_handler = new_thread_end_handler;
663663
return retval;
664-
}/*}}}*/
664+
}
665665

666666

667667
TSRM_API void *tsrm_set_shutdown_handler(tsrm_shutdown_func_t shutdown_handler)
668-
{/*{{{*/
668+
{
669669
void *retval = (void *) tsrm_shutdown_handler;
670670

671671
tsrm_shutdown_handler = shutdown_handler;
672672
return retval;
673-
}/*}}}*/
673+
}
674674

675675

676676
/*
@@ -679,7 +679,7 @@ TSRM_API void *tsrm_set_shutdown_handler(tsrm_shutdown_func_t shutdown_handler)
679679

680680
#if TSRM_DEBUG
681681
int tsrm_error(int level, const char *format, ...)
682-
{/*{{{*/
682+
{
683683
if (level<=tsrm_error_level) {
684684
va_list args;
685685
int size;
@@ -694,12 +694,12 @@ int tsrm_error(int level, const char *format, ...)
694694
} else {
695695
return 0;
696696
}
697-
}/*}}}*/
697+
}
698698
#endif
699699

700700

701701
void tsrm_error_set(int level, char *debug_filename)
702-
{/*{{{*/
702+
{
703703
tsrm_error_level = level;
704704

705705
#if TSRM_DEBUG
@@ -716,16 +716,16 @@ void tsrm_error_set(int level, char *debug_filename)
716716
tsrm_error_file = stderr;
717717
}
718718
#endif
719-
}/*}}}*/
719+
}
720720

721721
TSRM_API void *tsrm_get_ls_cache(void)
722-
{/*{{{*/
722+
{
723723
return tsrm_tls_get();
724-
}/*}}}*/
724+
}
725725

726726
/* Returns offset of tsrm_ls_cache slot from Thread Control Block address */
727727
TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void)
728-
{/*{{{*/
728+
{
729729
#if defined(__APPLE__) && defined(__x86_64__)
730730
// TODO: Implement support for fast JIT ZTS code ???
731731
return 0;
@@ -744,25 +744,25 @@ TSRM_API size_t tsrm_get_ls_cache_tcb_offset(void)
744744
#else
745745
return 0;
746746
#endif
747-
}/*}}}*/
747+
}
748748

749749
TSRM_API uint8_t tsrm_is_main_thread(void)
750-
{/*{{{*/
750+
{
751751
return in_main_thread;
752-
}/*}}}*/
752+
}
753753

754754
TSRM_API uint8_t tsrm_is_shutdown(void)
755-
{/*{{{*/
755+
{
756756
return is_thread_shutdown;
757-
}/*}}}*/
757+
}
758758

759759
TSRM_API const char *tsrm_api_name(void)
760-
{/*{{{*/
760+
{
761761
#if defined(TSRM_WIN32)
762762
return "Windows Threads";
763763
#else
764764
return "POSIX Threads";
765765
#endif
766-
}/*}}}*/
766+
}
767767

768768
#endif /* ZTS */

0 commit comments

Comments
 (0)