Skip to content

Instantly share code, notes, and snippets.

View xeioex's full-sized avatar

Dmitry Volyntsev xeioex

View GitHub Profile
diff --git a/src/njs_string.c b/src/njs_string.c
index 45639fa2..e137659f 100644
--- a/src/njs_string.c
+++ b/src/njs_string.c
@@ -608,7 +608,9 @@ njs_string_prototype_concat(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
njs_int_t ret;
njs_uint_t i;
njs_string_prop_t string;
- char buf[512+NJS_DTOA_MAX_LEN];
+ char buf[512 + NJS_DTOA_MAX_LEN];
use async_task::{Runnable, Task};
use flume::{Receiver, Sender, unbounded};
use std::future::Future;
use std::time::{Duration, Instant};
use std::task::{Context, Poll, Waker};
use std::pin::Pin;
use std::collections::BinaryHeap;
use std::cmp::Ordering;
use std::sync::{Arc, Mutex};
use async_task::{Runnable, Task};
use flume::{Receiver, Sender, unbounded};
use std::future::Future;
use std::time::{Duration, Instant};
use std::task::{Context, Poll, Waker};
use std::pin::Pin;
use std::collections::BinaryHeap;
use std::cmp::Ordering;
use std::sync::{Arc, Mutex};
use async_task::{Runnable, Task};
use flume::{Receiver, Sender, unbounded};
use std::future::Future;
use std::time::{Duration, Instant};
use std::task::{Context, Poll, Waker};
use std::pin::Pin;
use std::collections::BinaryHeap;
use std::cmp::Ordering;
use std::sync::{Arc, Mutex};
use async_task::{Runnable, Task};
use flume::{Receiver, Sender, unbounded};
use std::future::Future;
use std::time::{Duration, Instant};
use std::task::{Context, Poll, Waker};
use std::pin::Pin;
use std::collections::BinaryHeap;
use std::cmp::Ordering;
use std::sync::{Arc, Mutex};
use async_task::{Runnable, Task};
use flume::{Receiver, Sender, unbounded};
use std::future::Future;
use std::time::{Duration, Instant};
use std::task::{Context, Poll, Waker};
use std::pin::Pin;
use std::collections::BinaryHeap;
use std::cmp::Ordering;
use std::sync::{Arc, Mutex};
diff --git a/src/njs_flathsh.h b/src/njs_flathsh.h
index 985bdab1..e15162d6 100644
--- a/src/njs_flathsh.h
+++ b/src/njs_flathsh.h
@@ -91,14 +91,13 @@ NJS_EXPORT njs_int_t njs_flathsh_unique_find(const njs_flathsh_t *fh,
njs_flathsh_query_t *fhq);
/*
- * njs_flathsh_insert() adds a hash element. If the element is already
- * present in flathsh and the fhq->replace flag is zero, then fhq->value

Project Status: Active – The project has reached a stable, usable state and is being actively developed. Community Support

NGINX JavaScript Banner

NGINX JavaScript

NGINX JavaScript, also known as NJS, is a dynamic module for NGINX that enables the extension of built-in functionality using familiar JavaScript syntax. The NJS language is a subset of JavaScript, compliant with ES5 (ECMAScript 5.1 Strict Variant) with some ES6 (ECMAScript 6) and newer extensions. See compatibility for more details.

Table of Contents

  • [How i
diff --git a/src/njs_dtoa.h b/src/njs_dtoa.h
index 35ff09a5..4dcfc098 100644
--- a/src/njs_dtoa.h
+++ b/src/njs_dtoa.h
@@ -7,6 +7,8 @@
#ifndef _NJS_DTOA_H_INCLUDED_
#define _NJS_DTOA_H_INCLUDED_
+#define NJS_DTOA_MAX_LEN njs_length("-1.7976931348623157e+308")
+
diff --git a/src/njs_string.c b/src/njs_string.c
index 665aeb14..e0f82735 100644
--- a/src/njs_string.c
+++ b/src/njs_string.c
@@ -597,26 +597,22 @@ njs_string_prototype_to_string(njs_vm_t *vm, njs_value_t *args,
}
+#define NJS_NUM_TXT_BUF_LEN 512
+#define NJS_MAX_NUM_TXT_LEN njs_length("-1.7976931348623157e+308")