// // $Id: ipfw-data.c,v 1.6 2001/11/22 13:29:04 mavetju Exp $ // // // The data processing functions of ipfw-graph. // #include #include #include #include "ipfw-graph.h" // // Add 'value' to the 'table' in 'data' // If updatemax==TRUE, then update the global variable maxyvalue also // void update_data(long value,DATA_TYPE *data,bool updatemax) { if (maxyvalue==-1) data->new=value; data->old=data->new; data->new=value; memmove(data->table,data->table+1,sizeof(long)*(MAXSTORED-1)); data->table[MAXSTORED-1]=data->new-data->old; if (updatemax) { int i; memmove(maxyvalues,maxyvalues+1,(MAXSTORED-1)*sizeof(long)); maxyvalues[MAXSTORED-1]= data->table[MAXSTORED-1]==0 ? 1 : data->table[MAXSTORED-1]; maxyvalue=1; for (i=MAXSTORED-xsize;i