@@ -73,7 +73,7 @@ struct projectionContext {
7373 void * thread_id ;
7474 PJ_CONTEXT * proj_ctx ;
7575 unsigned ms_proj_data_change_counter ;
76- int ref_count ;
76+ int refcount ;
7777 pjCacheEntry pj_cache [PJ_CACHE_ENTRY_SIZE ];
7878 int pj_cache_size ;
7979 int cannotFindProjDb ;
@@ -370,7 +370,7 @@ projectionContext *msProjectionContextCreate(void) {
370370 msFree (ctx );
371371 return NULL ;
372372 }
373- ctx -> ref_count = 1 ;
373+ MS_REFCNT_INIT ( ctx ) ;
374374 proj_context_use_proj4_init_rules (ctx -> proj_ctx , TRUE);
375375 proj_log_func (ctx -> proj_ctx , ctx , msProjErrorLogger );
376376 return ctx ;
@@ -383,8 +383,7 @@ projectionContext *msProjectionContextCreate(void) {
383383void msProjectionContextUnref (projectionContext * ctx ) {
384384 if (!ctx )
385385 return ;
386- -- ctx -> ref_count ;
387- if (ctx -> ref_count == 0 ) {
386+ if (MS_REFCNT_DECR_IS_ZERO (ctx )) {
388387 int i ;
389388 for (i = 0 ; i < ctx -> pj_cache_size ; i ++ ) {
390389 msFree (ctx -> pj_cache [i ].inStr );
@@ -577,7 +576,7 @@ void msProjectionInheritContextFrom(projectionObj *pDst,
577576 if (pDst -> proj_ctx == NULL && pSrc -> proj_ctx != NULL ) {
578577 if (pSrc -> proj_ctx -> thread_id == msGetThreadId ()) {
579578 pDst -> proj_ctx = pSrc -> proj_ctx ;
580- pDst -> proj_ctx -> ref_count ++ ;
579+ MS_REFCNT_INCR ( pDst -> proj_ctx ) ;
581580 } else {
582581 pDst -> proj_ctx = msProjectionContextClone (pSrc -> proj_ctx );
583582 }
@@ -591,7 +590,7 @@ void msProjectionInheritContextFrom(projectionObj *pDst,
591590void msProjectionSetContext (projectionObj * p , projectionContext * ctx ) {
592591 if (p -> proj_ctx == NULL && ctx != NULL ) {
593592 p -> proj_ctx = ctx ;
594- p -> proj_ctx -> ref_count ++ ;
593+ MS_REFCNT_INCR ( p -> proj_ctx ) ;
595594 }
596595}
597596
0 commit comments