From: Frédéric Marchal Date: Wed, 17 Mar 2010 19:11:02 +0000 (+0000) Subject: Mimic an opaque object to read long lines X-Git-Tag: v2.3-pre2~44 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=afaa3b67ace1d532c959ec599d71e0026108f84d;p=thirdparty%2Fsarg.git Mimic an opaque object to read long lines --- diff --git a/authfail.c b/authfail.c index e8b3dee..693444f 100644 --- a/authfail.c +++ b/authfail.c @@ -52,7 +52,7 @@ void authfail_report(void) int cstatus; bool new_user; struct getwordstruct gwarea; - struct longlinestruct line; + longline line; struct userinfostruct *uinfo; if(DataFile[0] != '\0') return; @@ -112,12 +112,12 @@ void authfail_report(void) fputs("\n",fp_ou); fprintf(fp_ou,"%s%s%s%s\n",_("USERID"),_("IP/NAME"),_("DATE/TIME"),_("ACCESSED SITE")); - if (longline_prepare(&line)<0) { + if ((line=longline_create())==NULL) { debuga(_("Not enough memory to read file %s\n"),authfail_in); exit(EXIT_FAILURE); } - while((buf=longline_read(fp_in,&line))!=NULL) { + while((buf=longline_read(fp_in,line))!=NULL) { getword_start(&gwarea,buf); if (getword(data,sizeof(data),&gwarea,'\t')<0) { debuga(_("There is a broken date in file %s\n"),authfail_in); @@ -192,7 +192,7 @@ void authfail_report(void) fputs("\n",fp_ou); } fclose(fp_in); - longline_free(&line); + longline_destroy(&line); fputs("\n",fp_ou); write_html_trailer(fp_ou); diff --git a/datafile.c b/datafile.c index 082a400..5756204 100644 --- a/datafile.c +++ b/datafile.c @@ -63,7 +63,7 @@ void data_file(char *tmp) int ourl_size; struct getwordstruct gwarea; struct userinfostruct *uinfo; - struct longlinestruct line; + longline line; const char logext[]=".log"; ipantes[0]='\0'; @@ -112,14 +112,14 @@ void data_file(char *tmp) exit(EXIT_FAILURE); } - if (longline_prepare(&line)<0) { + if ((line=longline_create())==NULL) { debuga(_("Not enough memory to read the downloaded files.\n")); exit(EXIT_FAILURE); } ttopen=0; new_user=1; - while((buf=longline_read(fp_in,&line))!=NULL) { + while((buf=longline_read(fp_in,line))!=NULL) { getword_start(&gwarea,buf); if (getword(accdia,sizeof(accdia),&gwarea,'\t')<0 || getword(acchora,sizeof(acchora),&gwarea,'\t')<0 || getword(accip,sizeof(accip),&gwarea,'\t')<0 || @@ -211,7 +211,7 @@ void data_file(char *tmp) } fclose(fp_in); - longline_free(&line); + longline_destroy(&line); } (void)closedir( dirp ); if (oldurl) free(oldurl); diff --git a/denied.c b/denied.c index aac0c06..a126256 100644 --- a/denied.c +++ b/denied.c @@ -49,7 +49,7 @@ void gen_denied_report(void) int count=0; int new_user; struct getwordstruct gwarea; - struct longlinestruct line; + longline line; struct userinfostruct *uinfo; ouser[0]='\0'; @@ -94,12 +94,12 @@ void gen_denied_report(void) fputs("\n",fp_ou); fprintf(fp_ou,"%s%s%s%s\n",_("USERID"),_("IP/NAME"),_("DATE/TIME"),_("ACCESSED SITE")); - if (longline_prepare(&line)<0) { + if ((line=longline_create())==NULL) { debuga(_("Not enough memory to read the denied accesses\n")); exit(EXIT_FAILURE); } - while((buf=longline_read(fp_in,&line))!=NULL) { + while((buf=longline_read(fp_in,line))!=NULL) { getword_start(&gwarea,buf); if (getword(data,sizeof(data),&gwarea,'\t')<0 || getword(hora,sizeof(hora),&gwarea,'\t')<0 || getword(user,sizeof(user),&gwarea,'\t')<0 || getword(ip,sizeof(ip),&gwarea,'\t')<0) { @@ -163,7 +163,7 @@ void gen_denied_report(void) fputs("\n",fp_ou); } fclose(fp_in); - longline_free(&line); + longline_destroy(&line); fputs("\n",fp_ou); write_html_trailer(fp_ou); diff --git a/documentation/longline.txt b/documentation/longline.txt index 95d8359..01cf903 100644 --- a/documentation/longline.txt +++ b/documentation/longline.txt @@ -12,23 +12,28 @@ The initial buffer size to allocate to read a long line from a text file. -/*! \fn int longline_prepare(struct longlinestruct *line) +/*! \fn longline longline_create(void) Prepare the buffer to read long text lines from a file. -The memory allocated by this function must be freed with a call to -longline_free(). +\return The object create by the function. It must be freed +with a call to longline_destroy(). +*/ + + + + -\param line The buffer to initialize. +/*! \fn void longline_reset(longline line) +Reset the internal state of the object to start a new reading on a new file. -\retval 0 No error. -\retval -1 Not enough memory. +\param line The object created by longline_create(). */ -/*! \fn char *longline_read(FILE *fp_in,struct longlinestruct *line) +/*! \fn char *longline_read(FILE *fp_in,longline line) Read one long line of text from a file. If the buffer is too short, it is expended until the line can fit in it. @@ -39,7 +44,7 @@ by a null ASCII character. The CR or LF are removed. Any empty line is skipped. \param fp_in The file to read. -\param line The buffer initialized by longline_preapre(). +\param line The object created by longline_create(). \return A pointer to the beginning of the string in the buffer or NULL if it is the last string read. @@ -52,8 +57,8 @@ with an error message. -/*! \fn void longline_free(struct longlinestruct *line) -Free the memory allocated by longline_prepare(). +/*! \fn void longline_destroy(longline line) +Free the memory allocated by longline_create(). -\param line The buffer to free. +\param line The object to destroy. */ diff --git a/download.c b/download.c index 6f550b5..2e379df 100644 --- a/download.c +++ b/download.c @@ -54,7 +54,7 @@ void download_report(void) int i; int new_user; struct getwordstruct gwarea; - struct longlinestruct line; + longline line; struct userinfostruct *uinfo; ouser[0]='\0'; @@ -99,12 +99,12 @@ void download_report(void) fputs("\n",fp_ou); fprintf(fp_ou,"%s%s%s%s\n",_("USERID"),_("IP/NAME"),_("DATE/TIME"),_("ACCESSED SITE")); - if (longline_prepare(&line)<0) { + if ((line=longline_create())==NULL) { debuga(_("Not enough memory to read the downloaded files\n")); exit(EXIT_FAILURE); } - while((buf=longline_read(fp_in,&line))!=NULL) { + while((buf=longline_read(fp_in,line))!=NULL) { getword_start(&gwarea,buf); if (getword(data,sizeof(data),&gwarea,'\t')<0 || getword(hora,sizeof(hora),&gwarea,'\t')<0 || getword(user,sizeof(user),&gwarea,'\t')<0 || getword(ip,sizeof(ip),&gwarea,'\t')<0) { @@ -169,7 +169,7 @@ void download_report(void) fputs("\n",fp_ou); } fclose(fp_in); - longline_free(&line); + longline_destroy(&line); fputs("\n",fp_ou); write_html_trailer(fp_ou); diff --git a/html.c b/html.c index 5ab1ab4..e0119c3 100644 --- a/html.c +++ b/html.c @@ -60,7 +60,7 @@ void htmlrel(void) int dlen; char siteind[MAX_TRUNCATED_URL]; struct getwordstruct gwarea; - struct longlinestruct line,line1; + longline line,line1; struct generalitemstruct item; const struct userinfostruct *uinfo; @@ -88,14 +88,14 @@ void htmlrel(void) debuga(_("(html2) Cannot open file %s\n"),arqper); exit(EXIT_FAILURE); } - if (longline_prepare(&line)<0) { + if ((line=longline_create())==NULL) { debuga(_("Not enough memory to read file %s\n"),arqper); exit(EXIT_FAILURE); } ttnacc=0; totbytes=0; totelap=0; - while((buf=longline_read(fp_in,&line))!=NULL) { + while((buf=longline_read(fp_in,line))!=NULL) { ger_read(buf,&item,arqper); if(item.total) { ttnacc+=item.nacc; @@ -104,7 +104,7 @@ void htmlrel(void) } } fclose(fp_in); - longline_free(&line); + longline_destroy(&line); snprintf(arqper,sizeof(arqper),"%s/sarg-users",outdirname); if ((fp_in = fopen(arqper, "r")) == 0){ @@ -175,7 +175,7 @@ void htmlrel(void) exit(EXIT_FAILURE); } - if (longline_prepare(&line)<0) { + if ((line=longline_create())==NULL) { debuga(_("Not enough memory to read file %s\n"),arqin); exit(EXIT_FAILURE); } @@ -185,7 +185,7 @@ void htmlrel(void) tnelap=0; tnincache=0; tnoucache=0; - while((buf=longline_read(fp_in,&line))!=NULL) { + while((buf=longline_read(fp_in,line))!=NULL) { getword_start(&gwarea,buf); if (getword_atoll(<emp,&gwarea,'\t')<0) { debuga(_("There is a broken number of access in file %s\n"),arqin); @@ -266,7 +266,7 @@ void htmlrel(void) debuga(_("Making report: %s\n"),uinfo->id); } - while((buf=longline_read(fp_in,&line))!=NULL) { + while((buf=longline_read(fp_in,line))!=NULL) { getword_start(&gwarea,buf); if (getword_atoll(&twork,&gwarea,'\t')<0) { debuga(_("Maybe you have a broken number of access in your %s file\n"),arqin); @@ -377,15 +377,15 @@ void htmlrel(void) exit(EXIT_FAILURE); } - if (longline_prepare(&line1)<0) { + if ((line1=longline_create())==NULL) { debuga(_("Not enough memory to read file %s\n"),arqip); exit(EXIT_FAILURE); } - while((buf=longline_read(fp_ip,&line1))!=NULL) { + while((buf=longline_read(fp_ip,line1))!=NULL) { if(strstr(buf,url) != 0) fputs(buf,fp_ip2); } - longline_free(&line1); + longline_destroy(&line1); fclose(fp_ip); fclose(fp_ip2); @@ -405,11 +405,11 @@ void htmlrel(void) olduserip[0]='\0'; - if (longline_prepare(&line1)<0) { + if ((line1=longline_create())==NULL) { debuga(_("Not enough memory to read file %s\n"),arqip); exit(EXIT_FAILURE); } - while((buf=longline_read(fp_ip,&line1))!=NULL) { + while((buf=longline_read(fp_ip,line1))!=NULL) { getword_start(&gwarea,buf); if (getword(user_ip,sizeof(user_ip),&gwarea,'\t')<0) { debuga(_("Maybe you have a broken user IP in your %s file\n"),tmp3); @@ -450,7 +450,7 @@ void htmlrel(void) } fclose(fp_ip); - longline_free(&line1); + longline_destroy(&line1); unlink(tmp2); unlink(tmp3); @@ -465,7 +465,7 @@ void htmlrel(void) } fclose(fp_in); - longline_free(&line); + longline_destroy(&line); if(iprel) unlink(arqip); diff --git a/include/defs.h b/include/defs.h index 750c7b6..b0246d2 100755 --- a/include/defs.h +++ b/include/defs.h @@ -9,19 +9,7 @@ struct getwordstruct int modified; }; -struct longlinestruct -{ - //! The buffer to store the data read from the log file. - char *buffer; - //! The size of the buffer. - size_t size; - //! The number of bytes stored in the buffer. - size_t length; - //! The position of the beginning of the current string. - size_t start; - //! The position of the end of the current string. - size_t end; -}; +typedef struct longlinestruct *longline; struct generalitemstruct { @@ -129,6 +117,12 @@ void name2ip(char *name); // lastlog.c void mklastlog(const char *outdir); +// longline.c +/*@null@*//*@only@*/longline longline_create(void); +void longline_reset(longline line); +/*@null@*/char *longline_read(FILE *fp_in,/*@null@*/longline line); +void longline_destroy(/*@out@*//*@only@*//*@null@*/longline *line_ptr); + // index.c void make_index(void); @@ -253,6 +247,3 @@ void baddata(void); char *get_param_value(const char *param,char *line); int compar( const void *, const void * ); void unlinkdir(const char *dir,int contentonly); -int longline_prepare(/*@out@*/struct longlinestruct *line); -char *longline_read(FILE *fp_in,struct longlinestruct *line); -void longline_free(struct longlinestruct *line); diff --git a/log.c b/log.c index 9b06f42..d439a1d 100644 --- a/log.c +++ b/log.c @@ -147,7 +147,7 @@ int main(int argc,char *argv[]) int download_flag=0; char *download_url=NULL; struct getwordstruct gwarea; - struct longlinestruct line; + longline line; struct userinfostruct *uinfo; struct userfilestruct *first_user_file, *ufile, *ufile1, *prev_ufile; @@ -686,7 +686,7 @@ int main(int argc,char *argv[]) init_usertab(UserTabFile); - if (longline_prepare(&line)<0) { + if ((line=longline_create())==NULL) { debuga(_("Not enough memory to read a log file\n")); exit(EXIT_FAILURE); } @@ -735,18 +735,19 @@ int main(int argc,char *argv[]) if(ShowReadStatistics && !from_stdin) { size_t nread,i; int skipcr=0; + char tmp4[MAXLEN]; recs1=0UL; recs2=0UL; - while ((nread=fread(line.buffer,1,line.size,fp_in))>0) { + while ((nread=fread(tmp4,1,sizeof(tmp4),fp_in))>0) { for (i=0 ; isize=INITIAL_LINE_BUFFER_SIZE; line->buffer=malloc(line->size); - if (!line->buffer) - return(-1); + if (line->buffer==NULL) { + free(line); + return(NULL); + } line->start=0; line->end=0; line->length=0; - return(0); + return(line); } -char *longline_read(FILE *fp_in,struct longlinestruct *line) +void longline_reset(longline line) +{ + if (line!=NULL) { + line->start=0; + line->end=0; + line->length=0; + } +} + +char *longline_read(FILE *fp_in,longline line) { int i; char *newbuf; size_t nread; - if (!line->buffer) return(NULL); + if (line==NULL || line->buffer==NULL) return(NULL); - while (1) { + while (true) { for (i=line->end ; ilength && (line->buffer[i]=='\n' || line->buffer[i]=='\r') ; i++); if (ilength) { line->end=i; break; } - nread=(feof(fp_in)) ? 0 : fread(line->buffer,1,line->size,fp_in); + nread=(feof(fp_in)!=0) ? 0 : fread(line->buffer,1,line->size,fp_in); if (nread==0) return(NULL); line->length=nread; line->end=0; } line->start=line->end; - while (1) { + while (true) { for (i=line->end ; ilength && line->buffer[i]!='\n' && line->buffer[i]!='\r' ; i++); line->end=i; if (line->endlength) break; @@ -82,7 +111,7 @@ char *longline_read(FILE *fp_in,struct longlinestruct *line) } line->buffer=newbuf; } - nread=(feof(fp_in)) ? 0 : fread(line->buffer+line->length,1,line->size-line->length,fp_in); + nread=(feof(fp_in)!=0) ? 0 : fread(line->buffer+line->length,1,line->size-line->length,fp_in); if (nread==0) { if (line->end<=line->start) return(NULL); if (line->end>=line->size) { @@ -104,10 +133,13 @@ char *longline_read(FILE *fp_in,struct longlinestruct *line) return(line->buffer+line->start); } -void longline_free(struct longlinestruct *line) +void longline_destroy(longline *line_ptr) { - if (line->buffer) { - free(line->buffer); - line->buffer=NULL; - } + longline line; + + if (line_ptr==NULL || *line_ptr==NULL) return; + line=*line_ptr; + *line_ptr=NULL; + if (line->buffer!=NULL) free(line->buffer); + free(line); } diff --git a/realtime.c b/realtime.c index 81ee8df..0fa8439 100755 --- a/realtime.c +++ b/realtime.c @@ -48,7 +48,7 @@ static void getlog(void) char *buf; int fd1,fd2; int cstatus; - struct longlinestruct line; + longline line; init_usertab(UserTabFile); @@ -60,21 +60,21 @@ static void getlog(void) exit(EXIT_FAILURE); } - if (longline_prepare(&line)<0) { + if ((line=longline_create())==NULL) { debuga(_("Not enough memory to read the log file\n")); exit(EXIT_FAILURE); } sprintf(cmd,"tail -%d %s",realtime_access_log_lines,AccessLog[0]); fp = popen(cmd, "r"); - while((buf=longline_read(fp,&line)) != NULL ) + while((buf=longline_read(fp,line)) != NULL ) if (getdata(buf,tmp)<0) { debuga(_("Maybe a broken record or garbage was returned by %s\n"),cmd); exit(EXIT_FAILURE); } pclose(fp); fclose(tmp); - longline_free(&line); + longline_destroy(&line); sprintf(cmd,"sort -r -k 1,1 -k 2,2 -o \"%s\" \"%s\"",template2,template1); cstatus=system(cmd); @@ -191,7 +191,7 @@ static void datashow(const char *tmp) int url_len; int ourl_size=0; struct getwordstruct gwarea; - struct longlinestruct line; + longline line; if((fin=fopen(tmp,"r"))==NULL) { debuga(_("(realtime) open error %s - %s\n"),tmp,strerror(errno)); @@ -200,12 +200,12 @@ static void datashow(const char *tmp) header(); - if (longline_prepare(&line)<0) { + if ((line=longline_create())==NULL) { debuga(_("Not enough memory to read the log file\n")); exit(EXIT_FAILURE); } - while((buf=longline_read(fin,&line))!=NULL) { + while((buf=longline_read(fin,line))!=NULL) { fixendofline(buf); getword_start(&gwarea,buf); if (getword(dat,sizeof(dat),&gwarea,'\t')<0) { @@ -260,7 +260,7 @@ static void datashow(const char *tmp) } strcpy(ourl,url); } - longline_free(&line); + longline_destroy(&line); if (ourl) free(ourl); puts("\n\n\n\n"); diff --git a/report.c b/report.c index e17911b..5943768 100644 --- a/report.c +++ b/report.c @@ -77,7 +77,7 @@ void gerarel(void) int same_url; int new_user; struct getwordstruct gwarea; - struct longlinestruct line; + longline line; struct userinfostruct *uinfo,*puinfo; ipantes[0]='\0'; @@ -153,12 +153,12 @@ void gerarel(void) memset(oldacchoratt,0,sizeof(oldacchoratt)); new_user=1; - if (longline_prepare(&line)<0) { + if ((line=longline_create())==NULL) { debuga(_("Not enough memory to read the downloaded files\n")); exit(EXIT_FAILURE); } - while((buf=longline_read(fp_in,&line))!=NULL) { + while((buf=longline_read(fp_in,line))!=NULL) { getword_start(&gwarea,buf); if (getword(accdia,sizeof(accdia),&gwarea,'\t')<0 || getword(acchora,sizeof(acchora),&gwarea,'\t')<0 || getword(accip,sizeof(accip),&gwarea,'\t')<0 || @@ -336,7 +336,7 @@ void gerarel(void) } fclose(fp_in); - longline_free(&line); + longline_destroy(&line); if (oldurltt) free(oldurltt); unlink(tmp3); } diff --git a/siteuser.c b/siteuser.c index 13a57b7..6b04660 100644 --- a/siteuser.c +++ b/siteuser.c @@ -49,7 +49,7 @@ void siteuser(void) char *users; long long int obytes; int cstatus; - struct longlinestruct line; + longline line; struct generalitemstruct item; const struct userinfostruct *uinfo; @@ -115,12 +115,12 @@ void siteuser(void) } strcpy(users," "); - if (longline_prepare(&line)<0) { + if ((line=longline_create())==NULL) { debuga(_("Not enough memory to read file %s\n"),general2); exit(EXIT_FAILURE); } - while((buf=longline_read(fp_in,&line))!=NULL) { + while((buf=longline_read(fp_in,line))!=NULL) { ger_read(buf,&item,general2); if(item.total) continue; uinfo=userinfo_find_from_id(item.user); @@ -196,7 +196,7 @@ void siteuser(void) } } fclose(fp_in); - longline_free(&line); + longline_destroy(&line); if(nsitesusers) { fprintf(fp_ou,"%d%s%s%s\n",wwork1,wwork2,wwork3); } fclose(fp_in); - longline_free(&line); + longline_destroy(&line); fputs("\n",fp_ou); write_html_trailer(fp_ou); diff --git a/topuser.c b/topuser.c index 73d2339..f6769cc 100644 --- a/topuser.c +++ b/topuser.c @@ -56,7 +56,7 @@ void topuser(void) char *s; int cstatus; struct getwordstruct gwarea; - struct longlinestruct line; + longline line; struct generalitemstruct item; const struct userinfostruct *uinfo; @@ -102,12 +102,12 @@ void topuser(void) olduser[0]='\0'; totuser=0; - if (longline_prepare(&line)<0) { + if ((line=longline_create())==NULL) { debuga(_("Not enough memory to read the file %s\n"),wger); exit(EXIT_FAILURE); } - while((warea=longline_read(fp_in,&line))!=NULL) { + while((warea=longline_read(fp_in,line))!=NULL) { ger_read(warea,&item,wger); if(item.total) continue; if(strcmp(olduser,item.user) != 0) { @@ -137,7 +137,7 @@ void topuser(void) tnoucache+=item.oucache; } fclose(fp_in); - longline_free(&line); + longline_destroy(&line); if (olduser[0] != '\0') { fprintf(fp_top2,"%s\t%lld\t%lld\t%lld\t%lld\t%lld\n",olduser,tnbytes,tnacc,tnelap,tnincache,tnoucache); @@ -242,12 +242,12 @@ void topuser(void) ntopuser = 0; - if (longline_prepare(&line)<0) { + if ((line=longline_create())==NULL) { debuga(_("Not enough memory to read the downloaded files\n")); exit(EXIT_FAILURE); } - while((warea=longline_read(fp_top1,&line))!=NULL) { + while((warea=longline_read(fp_top1,line))!=NULL) { getword_start(&gwarea,warea); if (getword(user,sizeof(user),&gwarea,'\t')<0) { debuga(_("There is a broken user in file %s\n"),top1); @@ -346,7 +346,7 @@ void topuser(void) } fclose(fp_top1); unlink(top1); - longline_free(&line); + longline_destroy(&line); if((TopUserFields & TOPUSERFIELDS_TOTAL) != 0) { fputs("",fp_top3); diff --git a/totger.c b/totger.c index 74bc110..2489051 100644 --- a/totger.c +++ b/totger.c @@ -36,7 +36,7 @@ int totalger(const char *dirname, int debug, const char *outdir) long long int tincache=0, toucache=0; char wger[MAXLEN]; char *warea; - struct longlinestruct line; + longline line; struct generalitemstruct item; snprintf(wger,sizeof(wger),"%s/sarg-general",dirname); @@ -46,12 +46,12 @@ int totalger(const char *dirname, int debug, const char *outdir) exit(EXIT_FAILURE); } - if (longline_prepare(&line)<0) { + if ((line=longline_create())==NULL) { debuga(_("Not enough memory to read the temporary file %s\n"),wger); exit(EXIT_FAILURE); } - while((warea=longline_read(fp_in,&line))!=NULL) + while((warea=longline_read(fp_in,line))!=NULL) { ger_read(warea,&item,wger); tnacc+=item.nacc; @@ -62,7 +62,7 @@ int totalger(const char *dirname, int debug, const char *outdir) } fclose(fp_in); - longline_free(&line); + longline_destroy(&line); if((fp_ou=fopen(wger,"a"))==NULL) { debuga(_("(totger) Cannot open file %s\n"),wger); diff --git a/util.c b/util.c index 35b8f55..d453149 100644 --- a/util.c +++ b/util.c @@ -768,7 +768,7 @@ void obttotal(const char *dirname, const char *name, char *tbytes, int nuser, ch long long int med=0; long long int twork=0; struct getwordstruct gwarea; - struct longlinestruct line; + longline line; twork=0; tbytes[0]='\0'; @@ -782,12 +782,12 @@ void obttotal(const char *dirname, const char *name, char *tbytes, int nuser, ch } } - if (longline_prepare(&line)<0) { + if ((line=longline_create())==NULL) { debuga(_("Not enough memory to read the file %s\n"),wdir); exit(EXIT_FAILURE); } - while((buf=longline_read(fp_in,&line))!=NULL) { + while((buf=longline_read(fp_in,line))!=NULL) { if (strncmp(buf,"TOTAL\t",6) == 0) sep='\t'; //new file else if (strncmp(buf,"TOTAL ",6) == 0) @@ -813,7 +813,7 @@ void obttotal(const char *dirname, const char *name, char *tbytes, int nuser, ch break; } fclose(fp_in); - longline_free(&line); + longline_destroy(&line); if(nuser <= 0) { strcpy(media,"0");