Add SR_ prefix for MAX_NUM_PROBES/MAX_PROBENAME_LEN.

This commit is contained in:
Uwe Hermann 2011-02-20 18:39:47 +01:00
parent 4cea9eb20d
commit 9688b443f6
6 changed files with 12 additions and 11 deletions

View File

@ -212,7 +212,7 @@ static int data_bits(struct sr_output *o, const char *data_in,
char *outbuf, c; char *outbuf, c;
ctx = o->internal; ctx = o->internal;
max_linelen = MAX_PROBENAME_LEN + 3 + ctx->samples_per_line max_linelen = SR_MAX_PROBENAME_LEN + 3 + ctx->samples_per_line
+ ctx->samples_per_line / 8; + ctx->samples_per_line / 8;
/* /*
* Calculate space needed for probes. Set aside 512 bytes for * Calculate space needed for probes. Set aside 512 bytes for
@ -298,7 +298,7 @@ static int data_hex(struct sr_output *o, const char *data_in,
char *outbuf; char *outbuf;
ctx = o->internal; ctx = o->internal;
max_linelen = MAX_PROBENAME_LEN + 3 + ctx->samples_per_line max_linelen = SR_MAX_PROBENAME_LEN + 3 + ctx->samples_per_line
+ ctx->samples_per_line / 2; + ctx->samples_per_line / 2;
outsize = length_in / ctx->unitsize * ctx->num_enabled_probes outsize = length_in / ctx->unitsize * ctx->num_enabled_probes
/ ctx->samples_per_line * max_linelen + 512; / ctx->samples_per_line * max_linelen + 512;
@ -363,7 +363,7 @@ static int data_ascii(struct sr_output *o, const char *data_in,
char *outbuf; char *outbuf;
ctx = o->internal; ctx = o->internal;
max_linelen = MAX_PROBENAME_LEN + 3 + ctx->samples_per_line max_linelen = SR_MAX_PROBENAME_LEN + 3 + ctx->samples_per_line
+ ctx->samples_per_line / 8; + ctx->samples_per_line / 8;
/* /*
* Calculate space needed for probes. Set aside 512 bytes for * Calculate space needed for probes. Set aside 512 bytes for

View File

@ -27,11 +27,13 @@
struct context { struct context {
unsigned int num_enabled_probes; unsigned int num_enabled_probes;
unsigned int unitsize; unsigned int unitsize;
char *probelist[MAX_NUM_PROBES+1]; char *probelist[SR_MAX_NUM_PROBES + 1];
char *header; char *header;
}; };
#define MAX_HEADER_LEN 1024 + (MAX_NUM_PROBES * (MAX_PROBENAME_LEN + 10)) #define MAX_HEADER_LEN \
(1024 + (SR_MAX_NUM_PROBES * (SR_MAX_PROBENAME_LEN + 10)))
const char *gnuplot_header = "\ const char *gnuplot_header = "\
# Sample data in space-separated columns format usable by gnuplot\n\ # Sample data in space-separated columns format usable by gnuplot\n\
#\n\ #\n\

View File

@ -40,7 +40,7 @@ int data_ascii(struct sr_output *o, const char *data_in, uint64_t length_in,
char *outbuf; char *outbuf;
ctx = o->internal; ctx = o->internal;
max_linelen = MAX_PROBENAME_LEN + 3 + ctx->samples_per_line max_linelen = SR_MAX_PROBENAME_LEN + 3 + ctx->samples_per_line
+ ctx->samples_per_line / 8; + ctx->samples_per_line / 8;
/* /*
* Calculate space needed for probes. Set aside 512 bytes for * Calculate space needed for probes. Set aside 512 bytes for

View File

@ -40,7 +40,7 @@ int data_bits(struct sr_output *o, const char *data_in, uint64_t length_in,
char *outbuf, c; char *outbuf, c;
ctx = o->internal; ctx = o->internal;
max_linelen = MAX_PROBENAME_LEN + 3 + ctx->samples_per_line max_linelen = SR_MAX_PROBENAME_LEN + 3 + ctx->samples_per_line
+ ctx->samples_per_line / 8; + ctx->samples_per_line / 8;
/* /*
* Calculate space needed for probes. Set aside 512 bytes for * Calculate space needed for probes. Set aside 512 bytes for

View File

@ -40,7 +40,7 @@ int data_hex(struct sr_output *o, const char *data_in, uint64_t length_in,
char *outbuf; char *outbuf;
ctx = o->internal; ctx = o->internal;
max_linelen = MAX_PROBENAME_LEN + 3 + ctx->samples_per_line max_linelen = SR_MAX_PROBENAME_LEN + 3 + ctx->samples_per_line
+ ctx->samples_per_line / 2; + ctx->samples_per_line / 2;
outsize = length_in / ctx->unitsize * ctx->num_enabled_probes outsize = length_in / ctx->unitsize * ctx->num_enabled_probes
/ ctx->samples_per_line * max_linelen + 512; / ctx->samples_per_line * max_linelen + 512;

View File

@ -55,9 +55,8 @@ extern "C" {
#define SR_ERR_MALLOC -2 /* Malloc/calloc/realloc error */ #define SR_ERR_MALLOC -2 /* Malloc/calloc/realloc error */
#define SR_ERR_SAMPLERATE -3 /* Incorrect samplerate */ #define SR_ERR_SAMPLERATE -3 /* Incorrect samplerate */
/* limited by uint64_t */ #define SR_MAX_NUM_PROBES 64 /* Limited by uint64_t. */
#define MAX_NUM_PROBES 64 #define SR_MAX_PROBENAME_LEN 32
#define MAX_PROBENAME_LEN 32
/* Handy little macros */ /* Handy little macros */
#define KHZ(n) ((n) * 1000) #define KHZ(n) ((n) * 1000)