Le mardi 5 juillet 2011 19:04:22, grischka a écrit :
> Thomas Preud'homme wrote:
> > #ifdef CONFIG_TCC_EXTRA_LDDIR
> >
> > {
> >
> > const char delim[] = ":";
> > char *tok, *tok_extra_libdir = NULL, *tok_save_ptr,
> > *extra_libdir_str; size_t toklen = 0, old_toklen = 0;
> >
> > extra_libdir_str = tcc_strdup(CONFIG_TCC_EXTRA_LDDIR);
> > tok = strtok_r(extra_libdir_str, delim, &tok_save_ptr);
> > while (tok != NULL)
> > {
> >
> > toklen = strlen(CONFIG_SYSROOT "/usr/local") + strlen(tok);
> > if (toklen > old_toklen)
> >
> > tok_extra_libdir = tcc_realloc(tok_extra_libdir,
> >
> > toklen * sizeof(char));
> >
> > /* No need for snprintf: value in tok comes from tcc
> > compilation */ sprintf(tok_extra_libdir, CONFIG_SYSROOT
> > "%s", tok); tcc_add_library_path(s, tok_extra_libdir);
> > sprintf(tok_extra_libdir, CONFIG_SYSROOT "/usr/local%s",
> > tok); tcc_add_library_path(s, tok_extra_libdir);
> > tok = strtok_r(NULL, delim, &tok_save_ptr);
> >
> > }
> > tcc_free(tok_extra_libdir);
> >
> > }
> >
> > #endif
>
> Well, whatever you do, please try to give us new structure and not
> just new features!
>
> For example, this "extra" functionality could well live in its own
> function rather than as just another spaghetti inline hack.
>
> Also, splitting path components at colons is a general task, so it
> can have its own general purpose utility. For example:
>
> int tcc_split_path_components(const char *in, char ***out);
>
> which in tcc would probably return the components as a 'dynarray'.
Sure. I'll do it. Maybe not today but let's say tomorrow. By the way, there
were 2 bugs in the first patch:* no #define of CONFIG_TCC_LDDIR and CONFIG_TCC_EXTRA_LDDIR should be done if $lddir is unset or null, else the #ifndef CONFIG_TCC_LDDIR is useless * extralddir should not sort with : > > Also, I'd claim that using strtok is somehow un-tcc'ish, seen that > there are zero occurrences anywhere else. ;) Ah. Then what tcc'ish function should I use? > > Also, I don't see extra_libdir_str free'd in your patch ;) Oups. I'll fix it. By the way, I came up with simpler solution for this patch. Actually, all the code in configure is not necessary. One could use -D flag in CFLAGS to achieve the same result. So I think I'll also add another commit to remove everything from configure. > > Btw, I'm still thinking about 0.9.26. Great :) Please wait this is fixed then. I did a snapshot of the master branch for distribution in Debian. I plan to let it stay in Debian experimental for a few weeks (my initial plan is 1 month but I could do 2 weeks) and then upload it in Debian unstable where it will have more coverage. So if you want you can wait a month and I'll tell you if I have any bug report when it hit unstable. Note that I'm also fine for releasing now, especially since it would simplify my work. > > Best regards, Best regards. > > --- grischka Thomas Preud'homme > > > _______________________________________________ > Tinycc-devel mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/tinycc-devel
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
