@@ -272,7 +272,7 @@ void modperl_interp_init(server_rec *s, apr_pool_t *p,
272
272
static apr_status_t modperl_interp_pool_cleanup (void * data )
273
273
{
274
274
MP_TRACE_i (MP_FUNC , "unselecting: (0x%lx)->refcnt=%ld\n" ,
275
- data , ((modperl_interp_t * )data )-> refcnt );
275
+ data , ((modperl_interp_t * )data )-> refcnt );
276
276
277
277
return modperl_interp_unselect (data );
278
278
}
@@ -287,7 +287,7 @@ apr_status_t modperl_interp_unselect(void *data)
287
287
288
288
ap_assert (interp && MpInterpIN_USE (interp ));
289
289
MP_TRACE_i (MP_FUNC , "unselect(interp=0x%lx): refcnt=%d\n" ,
290
- (unsigned long )interp , interp -> refcnt );
290
+ (unsigned long )interp , interp -> refcnt );
291
291
if (interp -> refcnt != 0 ) {
292
292
-- interp -> refcnt ;
293
293
MP_TRACE_i (MP_FUNC , "interp=0x%lx, refcnt=%d -- interp still in use" ,
@@ -303,7 +303,7 @@ apr_status_t modperl_interp_unselect(void *data)
303
303
modperl_tipool_putback_data (mip -> tipool , data , interp -> num_requests );
304
304
305
305
MP_TRACE_i (MP_FUNC , "interp=0x%lx freed, tipool(size=%ld, in_use=%ld)\n" ,
306
- (unsigned long )interp , mip -> tipool -> size , mip -> tipool -> in_use );
306
+ (unsigned long )interp , mip -> tipool -> size , mip -> tipool -> in_use );
307
307
308
308
return APR_SUCCESS ;
309
309
}
@@ -349,64 +349,64 @@ modperl_interp_t *modperl_interp_pool_select(apr_pool_t *p,
349
349
modperl_interp_t * interp = NULL ;
350
350
351
351
if (is_startup ) {
352
- if (scfg ) {
353
- MP_TRACE_i (MP_FUNC , "using parent interpreter at startup" );
354
-
355
- if (!scfg -> mip ) {
356
- /* we get here if directive handlers are invoked
357
- * before server merge.
358
- */
359
- modperl_init_vhost (s , p , NULL );
352
+ if (scfg ) {
353
+ MP_TRACE_i (MP_FUNC , "using parent interpreter at startup" );
354
+
355
+ if (!scfg -> mip ) {
356
+ /* we get here if directive handlers are invoked
357
+ * before server merge.
358
+ */
359
+ modperl_init_vhost (s , p , NULL );
360
360
if (!scfg -> mip ) {
361
361
/* FIXME: We get here if global "server_rec" == s, scfg->mip
362
362
* is not created then. I'm not sure if that's bug or
363
363
* bad/good design decicision. For now just return NULL.
364
364
*/
365
365
return NULL ;
366
366
}
367
- }
367
+ }
368
368
369
- interp = scfg -> mip -> parent ;
370
- }
371
- else {
372
- if (!(interp = modperl_interp_pool_get (p ))) {
373
- interp = modperl_interp_get (s );
374
- modperl_interp_pool_set (p , interp );
375
-
376
- MP_TRACE_i (MP_FUNC , "set interp 0x%lx in pconf pool 0x%lx" ,
377
- (unsigned long )interp , (unsigned long )p );
378
- }
379
- else {
380
- MP_TRACE_i (MP_FUNC , "found interp 0x%lx in pconf pool 0x%lx" ,
381
- (unsigned long )interp , (unsigned long )p );
382
- }
383
- }
369
+ interp = scfg -> mip -> parent ;
370
+ }
371
+ else {
372
+ if (!(interp = modperl_interp_pool_get (p ))) {
373
+ interp = modperl_interp_get (s );
374
+ modperl_interp_pool_set (p , interp );
384
375
385
- /* set context (THX) for this thread */
386
- PERL_SET_CONTEXT (interp -> perl );
387
- /* let the perl interpreter point back to its interp */
388
- MP_THX_INTERP_SET (interp -> perl , interp );
376
+ MP_TRACE_i (MP_FUNC , "set interp 0x%lx in pconf pool 0x%lx" ,
377
+ (unsigned long )interp , (unsigned long )p );
378
+ }
379
+ else {
380
+ MP_TRACE_i (MP_FUNC , "found interp 0x%lx in pconf pool 0x%lx" ,
381
+ (unsigned long )interp , (unsigned long )p );
382
+ }
383
+ }
389
384
390
- return interp ;
385
+ /* set context (THX) for this thread */
386
+ PERL_SET_CONTEXT (interp -> perl );
387
+ /* let the perl interpreter point back to its interp */
388
+ MP_THX_INTERP_SET (interp -> perl , interp );
389
+
390
+ return interp ;
391
391
}
392
392
else if (!modperl_threaded_mpm ()) {
393
- MP_TRACE_i (MP_FUNC , "using parent interpreter in non-threaded mode" );
393
+ MP_TRACE_i (MP_FUNC , "using parent interpreter in non-threaded mode" );
394
394
395
- /* since we are not running in threaded mode PERL_SET_CONTEXT
396
- * is not necessary */
397
- /* PERL_SET_CONTEXT(scfg->mip->parent->perl); */
398
- /* let the perl interpreter point back to its interp */
399
- MP_THX_INTERP_SET (scfg -> mip -> parent -> perl , scfg -> mip -> parent );
395
+ /* since we are not running in threaded mode PERL_SET_CONTEXT
396
+ * is not necessary */
397
+ /* PERL_SET_CONTEXT(scfg->mip->parent->perl); */
398
+ /* let the perl interpreter point back to its interp */
399
+ MP_THX_INTERP_SET (scfg -> mip -> parent -> perl , scfg -> mip -> parent );
400
400
401
- return scfg -> mip -> parent ;
401
+ return scfg -> mip -> parent ;
402
402
}
403
403
else {
404
- request_rec * r ;
405
- apr_pool_userdata_get ((void * * )& r , "MODPERL_R" , p );
406
- ap_assert (r );
407
- MP_TRACE_i (MP_FUNC , "found userdata MODPERL_R in pool %#lx as %lx" ,
408
- (unsigned long )r -> pool , (unsigned long )r );
409
- return modperl_interp_select (r , NULL , s );
404
+ request_rec * r ;
405
+ apr_pool_userdata_get ((void * * )& r , "MODPERL_R" , p );
406
+ ap_assert (r );
407
+ MP_TRACE_i (MP_FUNC , "found userdata MODPERL_R in pool %#lx as %lx" ,
408
+ (unsigned long )r -> pool , (unsigned long )r );
409
+ return modperl_interp_select (r , NULL , s );
410
410
}
411
411
}
412
412
@@ -427,9 +427,9 @@ modperl_interp_t *modperl_interp_select(request_rec *r, conn_rec *c,
427
427
(unsigned long )scfg -> mip -> parent ,
428
428
s -> server_hostname , s -> port );
429
429
/* XXX: if no VirtualHosts w/ PerlOptions +Parent we can skip this */
430
- PERL_SET_CONTEXT (scfg -> mip -> parent -> perl );
431
- /* let the perl interpreter point back to its interp */
432
- MP_THX_INTERP_SET (scfg -> mip -> parent -> perl , scfg -> mip -> parent );
430
+ PERL_SET_CONTEXT (scfg -> mip -> parent -> perl );
431
+ /* let the perl interpreter point back to its interp */
432
+ MP_THX_INTERP_SET (scfg -> mip -> parent -> perl , scfg -> mip -> parent );
433
433
return scfg -> mip -> parent ;
434
434
}
435
435
@@ -442,11 +442,11 @@ modperl_interp_t *modperl_interp_select(request_rec *r, conn_rec *c,
442
442
MP_TRACE_i (MP_FUNC ,
443
443
"found interp 0x%lx in con config, refcnt incremented to %d\n" ,
444
444
(unsigned long )ccfg -> interp , ccfg -> interp -> refcnt );
445
- /* set context (THX) for this thread */
446
- PERL_SET_CONTEXT (ccfg -> interp -> perl );
447
- /* MP_THX_INTERP_SET is not called here because the interp
448
- * already belongs to the perl interpreter
449
- */
445
+ /* set context (THX) for this thread */
446
+ PERL_SET_CONTEXT (ccfg -> interp -> perl );
447
+ /* MP_THX_INTERP_SET is not called here because the interp
448
+ * already belongs to the perl interpreter
449
+ */
450
450
return ccfg -> interp ;
451
451
}
452
452
@@ -465,8 +465,8 @@ modperl_interp_t *modperl_interp_select(request_rec *r, conn_rec *c,
465
465
interp -> ccfg = ccfg ;
466
466
467
467
MP_TRACE_i (MP_FUNC ,
468
- "pulled interp 0x%lx from mip, num_requests is %d\n" ,
469
- (unsigned long )interp , interp -> num_requests );
468
+ "pulled interp 0x%lx from mip, num_requests is %d\n" ,
469
+ (unsigned long )interp , interp -> num_requests );
470
470
471
471
/*
472
472
* if a per-dir PerlInterpScope is specified, use it.
@@ -482,47 +482,47 @@ modperl_interp_t *modperl_interp_select(request_rec *r, conn_rec *c,
482
482
modperl_interp_scope_desc (scope ));
483
483
484
484
if (scope != MP_INTERP_SCOPE_HANDLER ) {
485
- desc = NULL ;
485
+ desc = NULL ;
486
486
if (c && (scope == MP_INTERP_SCOPE_CONNECTION || !r )) {
487
- p = c -> pool ;
488
- desc = "connection" ;
489
- }
490
- else if (r ) {
491
- request_rec * main_r = r -> main ;
492
-
493
- if (main_r && (scope == MP_INTERP_SCOPE_REQUEST )) {
494
- /* share 1 interpreter across sub-requests */
495
- for (; main_r ; main_r = main_r -> main ) {
496
- p = main_r -> pool ;
497
- }
498
- desc = "main request" ;
499
- }
500
- else {
501
- p = r -> pool ;
502
- desc = scope == MP_INTERP_SCOPE_REQUEST
487
+ p = c -> pool ;
488
+ desc = "connection" ;
489
+ }
490
+ else if (r ) {
491
+ request_rec * main_r = r -> main ;
492
+
493
+ if (main_r && (scope == MP_INTERP_SCOPE_REQUEST )) {
494
+ /* share 1 interpreter across sub-requests */
495
+ for (; main_r ; main_r = main_r -> main ) {
496
+ p = main_r -> pool ;
497
+ }
498
+ desc = "main request" ;
499
+ }
500
+ else {
501
+ p = r -> pool ;
502
+ desc = scope == MP_INTERP_SCOPE_REQUEST
503
503
? "main request"
504
- : "sub request" ;
505
- }
504
+ : "sub request" ;
505
+ }
506
506
}
507
507
508
- ap_assert (p );
508
+ ap_assert (p );
509
509
510
510
#ifdef MP_TRACE
511
- apr_pool_cleanup_register (p , (void * )interp ,
512
- modperl_interp_pool_cleanup ,
513
- modperl_interp_pool_cleanup );
511
+ apr_pool_cleanup_register (p , (void * )interp ,
512
+ modperl_interp_pool_cleanup ,
513
+ modperl_interp_pool_cleanup );
514
514
#else
515
- apr_pool_cleanup_register (p , (void * )interp ,
516
- modperl_interp_unselect ,
517
- modperl_interp_unselect );
515
+ apr_pool_cleanup_register (p , (void * )interp ,
516
+ modperl_interp_unselect ,
517
+ modperl_interp_unselect );
518
518
#endif
519
519
520
- /* add a reference for the registered cleanup */
521
- interp -> refcnt ++ ;
520
+ /* add a reference for the registered cleanup */
521
+ interp -> refcnt ++ ;
522
522
523
- MP_TRACE_i (MP_FUNC ,
524
- "registered unselect cleanup for interp 0x%lx in %s\n" ,
525
- (unsigned long )interp , desc );
523
+ MP_TRACE_i (MP_FUNC ,
524
+ "registered unselect cleanup for interp 0x%lx in %s\n" ,
525
+ (unsigned long )interp , desc );
526
526
}
527
527
528
528
return interp ;
0 commit comments