IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 139


Ignore:
Timestamp:
Mar 4, 2004, 4:57:24 PM (22 years ago)
Author:
rhl
Message:

Changed [Rr]efCntr to [Rr]efCounter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/draft/utils.tex

    r135 r139  
    359359The API for this field is:
    360360\begin{verbatim}
    361 int psMemGetRefCntr(void *vptr);        // return refcntr
    362 void *psMemIncrRefCntr(void *vptr);     // increment refcntr and return vptr
    363 void *psMemDecrRefCntr(void *vptr);     // decrement refcntr and return vptr
    364 \end{verbatim}
    365 
    366 The functions \code{psMemIncrRefCntr} and \code{psMemDecrRefCntr} shall
     361int psMemGetRefCounter(void *vptr);        // return refcounter
     362void *psMemIncrRefCounter(void *vptr);     // increment refcounter and return vptr
     363void *psMemDecrRefCounter(void *vptr);     // decrement refcounter and return vptr
     364\end{verbatim}
     365
     366The functions \code{psMemIncrRefCounter} and \code{psMemDecrRefCounter} shall
    367367return \code{NULL} if passed a \code{NULL} pointer.
    368368
     
    389389    if (simp == NULL) { return; }
    390390
    391     if (psMemGetRefCntr(simp) > 1) {
    392         (void)psMemDecrRefCntr(simp);
     391    if (psMemGetRefCounter(simp) > 1) {
     392        (void)psMemDecrRefCounter(simp);
    393393        return;
    394394    }
     
    401401\end{table}
    402402
    403 The \code{psMemBlock.refcntr} is clearly useful for detecting
     403The \code{psMemBlock.refcounter} is clearly useful for detecting
    404404attempts to free memory that is already free.  A more complex
    405405application is for allowing pointers to complex data-objects (e.g.
     
    407407(see table \ref{tabReferenceCounting}).
    408408
    409 Because of the use of the \code{refcntr} field, we can safely put items of
     409Because of the use of the \code{refcounter} field, we can safely put items of
    410410this type onto many lists:
    411411\goodbreak
    412412\begin{verbatim}
    413413simp = psSimpleNew("RHL", 0);
    414 psDlistAppend(list1, psMemIncrRefCntr(simp));
    415 psDlistAppend(list2, psMemIncrRefCntr(simp));
     414psDlistAppend(list1, psMemIncrRefCounter(simp));
     415psDlistAppend(list2, psMemIncrRefCounter(simp));
    416416psSimpleDel(simp);
    417417\end{verbatim}
     
    695695
    696696All data items placed onto lists (e.g. with \code{psDlistAdd})
    697 shall have their reference counters (section \ref{secMemRefcntr}) incremented.
     697shall have their reference counters (section \ref{secMemRefcounter}) incremented.
    698698When elements
    699699are removed from a list with \code{psDlistRemove}, they shall
     
    704704If \code{psDlistDel}'s argument \code{elemDel} is NULL, the
    705705list should be deleted, but not the elements on it (although their
    706 \code{refcntr}'s should be decremented).
     706\code{refcounter}'s should be decremented).
    707707
    708708The \code{psDlistGet} routine may be used to provide an iterator. The
     
    801801source file for a given type).
    802802
    803 The objects pointed to by these types have had their \code{refCntr}s
    804 incremented (see \ref{secMemRefcntr}); to remove an element from the array you
     803The objects pointed to by these types have had their \code{refCounter}s
     804incremented (see \ref{secMemRefcounter}); to remove an element from the array you
    805805need to say something like:
    806806\begin{verbatim}
    807807  psTypePtrArray *pt = psTypePtrArrayNew(10, 10);
    808   psType *xy = psMemDecrRefCntr(pt->arr[0]);
     808  psType *xy = psMemDecrRefCounter(pt->arr[0]);
    809809  pt->arr[0] = NULL;
    810810\end{verbatim}
     
    832832had their reference counters incremented
    833833when they were inserted onto the array.\footnote{%
    834   \eg{} \code{va->arr[i] = psMemIncrRefCntr(ptr);}}
     834  \eg{} \code{va->arr[i] = psMemIncrRefCounter(ptr);}}
    835835
    836836If \code{psVoidPtrArrayDel}'s argument \code{elemDel} is NULL, the
    837837list should be deleted, but not the elements on it (although their
    838 \code{refcntr}'s should be decremented).
     838\code{refcounter}'s should be decremented).
    839839
    840840\subsection{Examples of Array Types}
     
    885885    psXYArrayDel(t);
    886886
    887     psXY *xy = psMemDecrRefCntr(pt->arr[0]);
     887    psXY *xy = psMemDecrRefCounter(pt->arr[0]);
    888888    pt->arr[0] = NULL;
    889889    psXYDel(xy);   
Note: See TracChangeset for help on using the changeset viewer.