🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.c
Article #309375

Re: fir's sicl

#309375
From: Adam Wysocki
Date: Tue, 08 Aug 2017 14:49
60 lines
2189 bytes
"(fir)" <profesor.fir@gmail.com> wrote:

>     (it is early version, some things need to be
>     throwed out some added, most revritten but

Hmm, jest bug posixie - jest funkcja write, nie ma vrite... trzeba 
poprawić.

>      vprintf(format, args);

Generalnie błędy wyrzuca się na stderr... no i nie wyrzucasz newline w 
wywołaniach ERROR_EXIT, czyli powinieneś tutaj.

> inline int ChunkIsEmpty(chunk c)
> {
> 
>   if(c.beg==NULL || c.end==NULL || c.beg>c.end)
>   {
>      c.beg   = NULL;
>      c.end   = NULL;
>      return 1;
>   }
> 
>   return 0;
> }

Funkcja, która sprawdza, czy chunk jest pusty, modyfikuje tego chunka?

>     ERROR_EXIT("error obtaining file size for &s", filename);

%s

> chunk LoadChunk(char* file_name)
> {
>   static char* internal_text = NULL;

Po co ten static tu?

>   int readed =  fread(internal_text, 1, file_length, file);

Gdzie używasz readed?

> void CreateFile(char* filename)

Modyfikujesz zawartość filename? Nie... to gdzie const?

> int IsDigit(char c)
> {
>   if(c>='0' && c<='9') return 1;
>   else return 0;
> }

#include <ctype.h>
isdigit()

I tak dalej.

-- 
[ Email: a@b a=grp b=chmurka.net ]
[ Web:   http://www.chmurka.net/ ]
Technical Details
Message-ID: <omcj13$2ou$1$gof@news.chmurka.net>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!news.chmurka.net!.POSTED.pi.v.chmurka.net!not-for-mail
References: <6950309e-21a6-436f-a500-301fc68754d5@googlegroups.com> <0c601f7b-4830-4d01-894a-9960dc6333fd@googlegroups.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!news.chmurka.net!.POSTED.pi.v.chmurka.net!not-for-mail
From: gof@somewhere.invalid (Adam Wysocki)
Newsgroups: pl.comp.lang.c
Subject: Re: fir's sicl
Date: Tue, 8 Aug 2017 14:49:07 +0000 (UTC)
Organization: news.chmurka.net
Message-ID: <omcj13$2ou$1$gof@news.chmurka.net>
References: <6950309e-21a6-436f-a500-301fc68754d5@googlegroups.com> <0c601f7b-4830-4d01-894a-9960dc6333fd@googlegroups.com>
NNTP-Posting-Host: pi.v.chmurka.net
Mime-Version: 1.0
Injection-Date: Tue, 8 Aug 2017 14:49:07 +0000 (UTC)
Injection-Info: news.chmurka.net; posting-account="gof"; posting-host="pi.v.chmurka.net:172.24.44.20"; logging-data="2846"; mail-complaints-to="abuse-news.(at).chmurka.net"
User-Agent: tin/2.4.1-20161224 ("Daill") (UNIX) (Linux/4.4.50-v7+ (armv7l))
Cancel-Lock: sha1:vV1JyxayIeyGV0aq4d3+7dpesDU=
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit