changed to use STIX_STACK_GETARG() in prim_log()
This commit is contained in:
parent
1879417d9c
commit
711663255b
@ -1207,14 +1207,13 @@ static int prim_log (stix_t* stix, stix_ooi_t nargs)
|
|||||||
|
|
||||||
STIX_ASSERT (nargs >= 2);
|
STIX_ASSERT (nargs >= 2);
|
||||||
|
|
||||||
level = STIX_STACK_GET(stix, stix->sp - nargs + 1);
|
level = STIX_STACK_GETARG(stix, nargs, 0);
|
||||||
if (!STIX_OOP_IS_SMOOI(level)) mask = STIX_LOG_APP | STIX_LOG_INFO;
|
if (!STIX_OOP_IS_SMOOI(level)) mask = STIX_LOG_APP | STIX_LOG_INFO;
|
||||||
else mask = STIX_LOG_APP | STIX_OOP_TO_SMOOI(level);
|
else mask = STIX_LOG_APP | STIX_OOP_TO_SMOOI(level);
|
||||||
|
|
||||||
for (k = nargs - 1; k > 0; )
|
for (k = 1; k < nargs; k++)
|
||||||
{
|
{
|
||||||
--k;
|
msg = STIX_STACK_GETARG (stix, nargs, k);
|
||||||
msg = STIX_STACK_GET(stix, stix->sp - k);
|
|
||||||
|
|
||||||
if (msg == stix->_nil || msg == stix->_true || msg == stix->_false)
|
if (msg == stix->_nil || msg == stix->_true || msg == stix->_false)
|
||||||
{
|
{
|
||||||
|
@ -406,6 +406,7 @@ static void log_write (stix_t* stix, stix_oow_t mask, const stix_ooch_t* msg, st
|
|||||||
stix_oow_t ucslen, bcslen, msgidx;
|
stix_oow_t ucslen, bcslen, msgidx;
|
||||||
int n;
|
int n;
|
||||||
char ts[32];
|
char ts[32];
|
||||||
|
size_t tslen;
|
||||||
struct tm tm, *tmp;
|
struct tm tm, *tmp;
|
||||||
time_t now;
|
time_t now;
|
||||||
|
|
||||||
@ -420,8 +421,13 @@ static void log_write (stix_t* stix, stix_oow_t mask, const stix_ooch_t* msg, st
|
|||||||
#else
|
#else
|
||||||
tmp = localtime_r (&now, &tm);
|
tmp = localtime_r (&now, &tm);
|
||||||
#endif
|
#endif
|
||||||
strftime (ts, sizeof(ts), "%Y-%m-%d %H:%M:%S %z ", tmp);
|
tslen = strftime (ts, sizeof(ts), "%Y-%m-%d %H:%M:%S %z ", tmp);
|
||||||
write_all (1, ts, strlen(ts));
|
if (tslen == 0)
|
||||||
|
{
|
||||||
|
strcpy (ts, "0000-00-00 00:00:00 +0000");
|
||||||
|
tslen = 25;
|
||||||
|
}
|
||||||
|
write_all (1, ts, tslen);
|
||||||
|
|
||||||
msgidx = 0;
|
msgidx = 0;
|
||||||
while (len > 0)
|
while (len > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user