9 Commits

Author SHA1 Message Date
Stanislav Gromov
0cb9fb3ff6 Misc. minor fixes (#423)
* Misc. minor fixes

* Fix OOB array access in encode_cell()

* Fix memory leaks in plungequalifiedfile()

* Remove redundant NULL pointer checks

* Fix invalid uses of realloc()

* Remove 'do_switch()'

* Don't use 'strlen()' to identify empty strings

* Other minor fixes

* Fix incorrect error message when compression is ineffective

* Add macro 'strempty' to identify empty strings
2019-06-17 02:57:49 +02:00
Zeex
16995c5ee1 Whitespace cleanup 2018-08-11 23:12:45 +06:00
Zeex
eeefc4ba3b Fix compile warnings 2015-04-02 15:58:00 +06:00
Zeex
2aa132d345 Fix crash when compiling with -r
This fixes a crash in sc_attachdocumentation() where get_docstring()
returned an invalid string pointer because get_string() compared the
string index with list->size instead of list->length (the actual length
of the list).

Fixes #19.
2014-04-06 00:44:25 +07:00
Zeex
74625128c4 Another stringlist fix
The previous one didn't quite work with the docstring list.
2014-01-26 00:19:41 +07:00
Zeex
8a32378617 Revert "Optimize stringlist functions"
This reverts commit fba30db927355e73fd3119f3365cea3ae1e9ad2d.

Conflicts:
	source/compiler/sclist.c
2014-01-25 20:59:15 +07:00
Zeex
77bde2ea54 More optimal array growth factor
http://stackoverflow.com/questions/1100311/what-is-the-ideal-growth-rate-for-a-dynamically-allocated-array
2014-01-25 20:07:09 +07:00
Zeex
fba30db927 Optimize stringlist functions
The get_string() function becomes a major bottleneck (around 80% of
the time) when debug info is on because it uses a linked list for
storage and it's mostly called in for loops iterating over the whole
list by index. That's a quadratic complexity.

This patch rewrites all stringlist functions to use an array instead
of a linked list. It decreased my test script's compile time from 84s
to 10s, or by 730%(!). The script is just 100,000 lines of print()
statements. If debug info is turned off the times are the same for both
implementations.
2014-01-25 14:40:32 +07:00
Zeex
766b96bcf3 Lower case directory names 2013-09-19 13:06:46 +07:00