Re: [dev] URI Parser

From: Kurt Van Dijck <dev.kurt_AT_vandijck-laurijssen.be>
Date: Thu, 13 Jun 2019 10:42:05 +0200

On do, 13 jun 2019 08:49:58 +0200, Laslo Hunhold wrote:
> On Thu, 13 Jun 2019 01:22:48 +0300
> Adrian Grigore <adrian.emil.grigore_AT_gmail.com> wrote:
>
> Dear Adrian,
>
> > I started writing a RFC3986 compliant URI parser. It's not done yet.
> > Can I get some feedback?
> >
> > https://adi.tilde.institute/tmp/uri.h
> > https://adi.tilde.institute/tmp/parseuri.c
>
> please find my feedback and suggestions below:
>
> 1) First off, you might want to think about hosting your own git or (if
> that is not possible) at least upload it to GitHub or Sourcehut. Given
> such links tend to die and the files themselves aren't too large, I've
> attached them to this response so they are preserved for posterity.

I think what you want to reach is very similar to my
https://github.com/kurt-vd/libet/liburi.c
https://github.com/kurt-vd/libet/liburi.h

Just for my information, what parts are incomplete?

>
> 2) Don't forget to add a LICENSE.
>
> 3) Don't typedef non-opaque structs!!! Remove the typedefs and
> rename the structs to lowercase equivalents, e.g. "struct Uri -> struct
> uri" etc. (uppercase names are reserved for opaque types, and your
> structs are not opaque)

there is also no reason to typedef opaque structs either.

>
> 7) I don't see any reason why you would allocate memory anywhere in the
> code. There is no need for that. Also, if you insist on allocating
> memory, check your malloc()'s and strdup()'s.

Either you allocate in the code, or you assume that the input remains
available, and you are allowed to modify.
The latter is not trivial either.

>
> I hope this feedback is helpful.
>
> With best regards
>
> Laslo Hunhold
>

Kind regards,
Kurt
Received on Thu Jun 13 2019 - 10:42:05 CEST

This archive was generated by hypermail 2.3.0 : Thu Jun 13 2019 - 11:24:08 CEST