summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorMichaël Meyer <hierophanie@gmail.com>2015-12-09 19:55:48 +0100
committerMichaël Meyer <hierophanie@gmail.com>2015-12-09 19:55:48 +0100
commit26436c9775e36ec9f608574b87626de139b345ba (patch)
treeab3a7fbd14a0c7ca5b6d0725423ba27d3118eed2 /data
parent6b510deff274dc79b4e324abef5fbb45a8162861 (diff)
downloadlibutf8proc-26436c9775e36ec9f608574b87626de139b345ba.tar.gz
libutf8proc-26436c9775e36ec9f608574b87626de139b345ba.tar.bz2
Reduce the size of the binary.
Use integers instead of pointers in Unicode tables. Saves 226 kb / 716 kb in the compiled library.
Diffstat (limited to 'data')
-rw-r--r--data/data_generator.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/data/data_generator.rb b/data/data_generator.rb
index 0fd25c0..c90c1f7 100644
--- a/data/data_generator.rb
+++ b/data/data_generator.rb
@@ -116,13 +116,14 @@ def str2c(string, prefix)
return "UTF8PROC_#{prefix}_#{string.upcase}"
end
def ary2c(array)
- return "NULL" if array.nil?
+ return "UINT16_MAX" if array.nil?
unless $int_array_indicies[array]
$int_array_indicies[array] = $int_array.length
array.each { |entry| $int_array << entry }
$int_array << -1
end
- return "utf8proc_sequences + #{$int_array_indicies[array]}"
+ raise "Array index out of bound" if $int_array_indicies[array] >= 65535
+ return "#{$int_array_indicies[array]}"
end
class UnicodeChar
@@ -305,7 +306,7 @@ end
$stdout << "};\n\n"
$stdout << "const utf8proc_property_t utf8proc_properties[] = {\n"
-$stdout << " {0, 0, 0, 0, NULL, NULL, -1, -1, -1, -1, -1, false,false,false,false, UTF8PROC_BOUNDCLASS_OTHER, 0},\n"
+$stdout << " {0, 0, 0, 0, UINT16_MAX, UINT16_MAX, -1, -1, -1, -1, -1, false,false,false,false, UTF8PROC_BOUNDCLASS_OTHER, 0},\n"
properties.each { |line|
$stdout << line
}