root/sapi/fpm/fpm/fpm_trace.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. fpm_trace_get_strz

   1 
   2         /* $Id: fpm_trace.c,v 1.1 2008/07/20 20:59:00 anight Exp $ */
   3         /* (c) 2007,2008 Andrei Nigmatulin */
   4 
   5 #include "fpm_config.h"
   6 
   7 #include <sys/types.h>
   8 
   9 #include "fpm_trace.h"
  10 
  11 int fpm_trace_get_strz(char *buf, size_t sz, long addr) /* {{{ */
  12 {
  13         int i;
  14         long l = addr;
  15         char *lc = (char *) &l;
  16 
  17         i = l % SIZEOF_LONG;
  18         l -= i;
  19         for (addr = l; ; addr += SIZEOF_LONG) {
  20                 if (0 > fpm_trace_get_long(addr, &l)) {
  21                         return -1;
  22                 }
  23                 for ( ; i < SIZEOF_LONG; i++) {
  24                         --sz;
  25                         if (sz && lc[i]) {
  26                                 *buf++ = lc[i];
  27                                 continue;
  28                         }
  29                         *buf = '\0';
  30                         return 0;
  31                 }
  32                 i = 0;
  33         }
  34 }
  35 /* }}} */
  36 
  37 

/* [<][>][^][v][top][bottom][index][help] */