aboutsummaryrefslogtreecommitdiff
path: root/src/preamble.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/preamble.js')
-rw-r--r--src/preamble.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/preamble.js b/src/preamble.js
index d56891d0..86a5ce80 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -765,11 +765,14 @@ Module['String_copy'] = String_copy;
// This processes a JS string into a C-line array of numbers, 0-terminated.
// For LLVM-originating strings, see parser.js:parseLLVMString function
-function intArrayFromString(stringy, dontAddNull) {
+function intArrayFromString(stringy, dontAddNull, length /* optional */) {
var ret = [];
var t;
var i = 0;
- while (i < stringy.length) {
+ if (length === undefined) {
+ length = stringy.length;
+ }
+ while (i < length) {
var chr = stringy.charCodeAt(i);
if (chr > 0xFF) {
#if ASSERTIONS