News for hackers. Stuff that matters.
Re:Libsass – C implementation of a Sass compiler by hcatlin on Monday November 25, 2013 @08:56PM (#6798564)
Wow, didn't expect to see this at the top of HN. Thanks kudo for promoting the project!

Aaron Leung and I have been working on this for a while. I'm the original creator of Sass and Aaron is a badass computer linguist. Hoping to announce some big new features around the end of the year.

Official site is at: http://libsass.org Or, follow us on Twitter for more updates: @hcatlin & @akhleung

Re:Libsass – C implementation of a Sass compiler by akhleung on Monday November 25, 2013 @09:07PM (#6798604)
Yes, playing catch-up with Ruby Sass has been difficult (the sophistication and subtlety of some of Sass's features are impressive), but we're hoping to make some big leaps by the end of the year!
Re:Libsass – C implementation of a Sass compiler by mradmin on Tuesday November 26, 2013 @05:35AM (#6800327)
Are you planning on creating the sass-convert utility?
Re:Libsass – C implementation of a Sass compiler by WalterSear on Monday November 25, 2013 @10:19PM (#6798897)
I'm sure I'm not the only person who's spent more time than they should trying to decide whether rebuilding sass would take longer overall than just waiting for the ruby one to finish compiling something :)

Thanks for this!

Re:Libsass – C implementation of a Sass compiler by mhogomchungu on Monday November 25, 2013 @09:31PM (#6798712)
a bit of optimization in $src/libsass/copy_c_str.cpp

        char* copy_c_str(const char* orig)
        {
                size_t len =  strlen(orig) + 1 ;             
                char* copy = (char*) malloc(sizeof(char) * len );
                memcpy(copy, orig, len);
                return copy;
        }
Re:Libsass – C implementation of a Sass compiler by unwind on Tuesday November 26, 2013 @03:24AM (#6799895)
Uh, okay. I didn't read the original, sounds somewhat scary.

Anyway, please don't cast the return value of malloc() in C (http://stackoverflow.com/a/605858/28169).

Also, of course len should be const and sizeof (char) should be removed. Also testing whether malloc() succeeded before relying on the result being valid is a good idea (but perhaps there's machinery in place to abort on error), as is deciding what to do if the input string is NULL.

Re:Libsass – C implementation of a Sass compiler by dchest on Tuesday November 26, 2013 @04:55AM (#6800201)
Anyway, please don't cast the return value of malloc() in C (http://stackoverflow.com/a/605858/28169).

It's C++.

Re:Libsass – C implementation of a Sass compiler by stevekemp on Tuesday November 26, 2013 @04:07AM (#6800073)
Wouldn't this be even better:

    return( strdup( orig ) );

?
Re:Libsass – C implementation of a Sass compiler by mtklein on Monday November 25, 2013 @09:39PM (#6798746)
or maybe just #define copy_c_str strdup ?
Re:Libsass – C implementation of a Sass compiler by akhleung on Monday November 25, 2013 @09:39PM (#6798745)
Thanks, I'll give it a try and benchmark it. Also, pull requests are welcome for this sort of thing!
[deleted]
Re:Libsass – C implementation of a Sass compiler by beagle3 on Tuesday November 26, 2013 @04:13AM (#6800086)
it will; he allocates and copies strlen()+1 bytes
Re:Libsass – C implementation of a Sass compiler by kudu on Monday November 25, 2013 @09:09PM (#6798612)
No problem, thanks for your work on Sass! I suggest linking to the website from the GitHub repo, I hadn't seen it.
Re:Libsass – C implementation of a Sass compiler by nightwolf on Tuesday November 26, 2013 @01:39AM (#6799553)
JFYI: The link to SassC on http://libsass.org is broken.