From: Frédéric Marchal Date: Wed, 19 May 2010 19:36:01 +0000 (+0000) Subject: Remove the unnecessary constants in the graph creation X-Git-Tag: v2.3-pre5~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=75288d49882455fa658381dc19d04e3ffa5dedd5;p=thirdparty%2Fsarg.git Remove the unnecessary constants in the graph creation --- diff --git a/grepday.c b/grepday.c index 2175f2c..107b958 100644 --- a/grepday.c +++ b/grepday.c @@ -29,14 +29,6 @@ #if defined(HAVE_GD) -//! The constant ln(1024). -#define LOG1024 6.931471805599453084 - -//! The constant to convert back a linearized binary scale (must be exp(LOGBIN)). -#define EXPBIN 1024. -//! The constant to linearise the logarithmic binary scale. -#define LOGBIN LOG1024 - #if defined(HAVE_ICONV_H) && defined(gdFTEX_Unicode) #include #define USE_ICONV 1 @@ -317,10 +309,10 @@ static int greport_compute_yaxis(struct PlotStruct *pdata,struct GraphDataStruct case PTG_LogBin: if (pdata->ymin>0.) - symin=log(pdata->ymin)/LOGBIN; + symin=log(pdata->ymin); else symin=0.; - symax=log(pdata->ymax)/LOGBIN; + symax=log(pdata->ymax); ymag=1024.; break; @@ -397,7 +389,7 @@ static void greport_draw_yaxis(struct PlotStruct *pdata,struct GraphDataStruct * break; case PTG_LogBin: - yval=pow(EXPBIN,(double)(y0-y)/gdata->YScale+log(pdata->ymin)/LOGBIN); + yval=exp((double)(y0-y)/gdata->YScale+log(pdata->ymin)); greport_formatbin(yval,2,YLabel,sizeof(YLabel)); break; @@ -591,9 +583,9 @@ static void greport_plot(const struct userinfostruct *uinfo,struct PlotStruct *p if (yval<=pdata->ymin) yval=0.; else if (yval>pdata->ymax) - yval=(log(pdata->ymax)-logpmin)/LOGBIN; + yval=log(pdata->ymax)-logpmin; else - yval=(log(yval)-logpmin)/LOGBIN; + yval=log(yval)-logpmin; greport_formatbin(pdata->datapoints[day],1,blabel,sizeof(blabel)); break; case PTG_Time: