Changeset 26 in libcf for trunk/src/cf_debug.c


Ignore:
Timestamp:
02/04/13 17:00:53 (11 years ago)
Author:
cheese
Message:

#1 documentation with doxygen

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/cf_debug.c

    r23 r26  
    4646    CF_DEBUG_CALLSTACK  callstack;
    4747} S_CF_DEBUG_CTX, CF_DEBUG_CTX;
     48
     49static int
     50CF_Debug_Local_UpdateCtx (CF_Debug_Ctx  ctx,
     51                          const char    * file,
     52                          const char    * func,
     53                          const int     line)
     54{
     55    CF_DEBUG_CTX * context = (CF_DEBUG_CTX *) ctx;
     56
     57    CHECK_INVALID_CTX (ctx);
     58
     59    strncpy (context->file, file, strlen (file));
     60    strncpy (context->func, func, strlen (func));
     61    context->line = line;
     62
     63    return CF_OK;
     64}
    4865
    4966static int
     
    205222
    206223int
    207 CF_Debug_UpdateCtx (CF_Debug_Ctx    ctx,
    208                     const char      * file,
    209                     const char      * func,
    210                     const int       line)
    211 {
    212     CF_DEBUG_CTX * context = (CF_DEBUG_CTX *) ctx;
    213 
    214     CHECK_INVALID_CTX (ctx);
    215 
    216     strncpy (context->file, file, strlen (file));
    217     strncpy (context->func, func, strlen (func));
    218     context->line = line;
    219 
    220     return CF_OK;
    221 }
    222 
    223 int
    224224CF_Debug_Trace (CF_Debug_Ctx    ctx,
     225                const char      * file,
     226                const char      * func,
     227                const int       line,
    225228                const char      * fmt, ...)
    226229{
     
    229232
    230233    CHECK_INVALID_CTX (ctx);
     234
     235    CF_Debug_Local_UpdateCtx (ctx, file, func, line);
    231236
    232237    va_start (valist, fmt);
     
    243248int
    244249CF_Debug_TraceBin (CF_Debug_Ctx         ctx,
     250                   const char           * file,
     251                   const char           * func,
     252                   const int            line,
    245253                   const unsigned char  * bin,
    246254                   const int            len,
     
    251259 
    252260    CHECK_INVALID_CTX (ctx);
     261
     262    CF_Debug_Local_UpdateCtx (ctx, file, func, line);
    253263
    254264    va_start (valist, fmt);
     
    291301    context->callstack.caller = push;
    292302
    293     CF_Debug_UpdateCtx (ctx, file, func, line);
     303    CF_Debug_Local_UpdateCtx (ctx, file, func, line);
    294304
    295305    return CF_OK;
     
    323333    if (pop->caller != NULL)
    324334    {
    325         CF_Debug_UpdateCtx (ctx,
    326                             pop->caller->file,
    327                             pop->caller->func,
    328                             pop->caller->line);
     335        CF_Debug_Local_UpdateCtx (ctx,
     336                                  pop->caller->file,
     337                                  pop->caller->func,
     338                                  pop->caller->line);
    329339    }
    330340
Note: See TracChangeset for help on using the changeset viewer.