diff --git a/sr_port/dpgbldir.c b/sr_port/dpgbldir.c index f471c2f6c..1b4c77d31 100644 --- a/sr_port/dpgbldir.c +++ b/sr_port/dpgbldir.c @@ -85,7 +85,7 @@ gd_addr *zgbldir(mval *v) return name->gd_ptr; if (!v->str.len) { - if (NULL != getenv(YDB_GBLDIR)) + if (NULL != getenv(YDB_GBLDIR + 1)) /* + 1 to get past '$' this call doesn't use */ { temp_mstr.addr = YDB_GBLDIR; temp_mstr.len = SIZEOF(YDB_GBLDIR); diff --git a/sr_port/gtm_env_init.c b/sr_port/gtm_env_init.c index ebbd5c199..d52754aac 100755 --- a/sr_port/gtm_env_init.c +++ b/sr_port/gtm_env_init.c @@ -413,8 +413,8 @@ void gtm_env_init(void) TREF(jnl_extract_nocol) = trans_numeric(&val, &is_defined, TRUE); # endif /* Initialize dollar_zmaxtptime */ - val.addr = YDB_ZMAXTPTIME; - val.len = SIZEOF(YDB_ZMAXTPTIME) - 1; + val.addr = YDB_MAXTPTIME; + val.len = SIZEOF(YDB_MAXTPTIME) - 1; status = trans_numeric(&val, &is_defined, TRUE); if (!is_defined) { diff --git a/sr_port/libydberrors2.h b/sr_port/libydberrors2.h index 466f70d41..3f6e79454 100644 --- a/sr_port/libydberrors2.h +++ b/sr_port/libydberrors2.h @@ -26,10 +26,9 @@ #define YDB_ERR_MISSINGVARNAMES -151027802 #define YDB_ERR_TOOMANYVARNAMES -151027810 #define YDB_ERR_INVNAMECOUNT -151027818 -#define YDB_ERR_UNKNOWN -151027826 +#define YDB_ERR_MISSINGVARNAME -151027826 #define YDB_ERR_TIME2LONG -151027834 #define YDB_ERR_VARNAME2LONG -151027842 #define YDB_ERR_FATALERROR1 -151027850 #define YDB_ERR_FATALERROR2 -151027858 #define YDB_ERR_SIMPLEAPINEST -151027868 -#define YDB_ERR_MISSINGVARNAME -151027874 diff --git a/sr_port/ydberrors.h b/sr_port/ydberrors.h index 90e5dff88..3a913d516 100644 --- a/sr_port/ydberrors.h +++ b/sr_port/ydberrors.h @@ -26,10 +26,9 @@ #define ERR_MISSINGVARNAMES 151027802 #define ERR_TOOMANYVARNAMES 151027810 #define ERR_INVNAMECOUNT 151027818 -#define ERR_UNKNOWN 151027826 +#define ERR_MISSINGVARNAME 151027826 #define ERR_TIME2LONG 151027834 #define ERR_VARNAME2LONG 151027842 #define ERR_FATALERROR1 151027850 #define ERR_FATALERROR2 151027858 #define ERR_SIMPLEAPINEST 151027868 -#define ERR_MISSINGVARNAME 151027874 diff --git a/sr_port/ydberrors.msg b/sr_port/ydberrors.msg index 64d580a92..637617fe2 100644 --- a/sr_port/ydberrors.msg +++ b/sr_port/ydberrors.msg @@ -34,10 +34,9 @@ SUBSARRAYNULL /error/fao=0 TOOMANYVARNAMES /error/fao=1 INVNAMECOUNT /error/fao=2 -UNKNOWN /error/fao=0 +MISSINGVARNAME /error/fao=0 TIME2LONG /error/fao=1 VARNAME2LONG /error/fao=1 FATALERROR1 /error/fao=2 FATALERROR2 /error/fao=2 SIMPLEAPINEST /fatal/fao=4 -MISSINGVARNAME /error/fao=0 diff --git a/sr_port/ydberrors_ctl.c b/sr_port/ydberrors_ctl.c index 48859f30a..7eb1efb8d 100644 --- a/sr_port/ydberrors_ctl.c +++ b/sr_port/ydberrors_ctl.c @@ -30,13 +30,12 @@ LITDEF err_msg ydberrors[] = { { "MISSINGVARNAMES", "At least one variable name must be specified", 0 }, { "TOOMANYVARNAMES", "Number of varnames specified exceeds maximum (!UL)", 1 }, { "INVNAMECOUNT", "Invalid value for namecount parameter in a !AD call", 2 }, - { "UNKNOWN", "Unknown error code specified", 0 }, + { "MISSINGVARNAME", "Required varname not specified", 0 }, { "TIME2LONG", "Specified time value exceeds supported maximum (!UL)", 1 }, { "VARNAME2LONG", "Variable name length exceeds maximum allowed (!UL)", 1 }, { "FATALERROR1", "Fatal error raised. Generating core and terminating process. Error: !AD", 2 }, { "FATALERROR2", "Fatal error raised. Bypassing core generation and terminating process. Error: !AD", 2 }, { "SIMPLEAPINEST", "Attempt to nest call of !AD with a call to !AD - nesting calls is not permitted in simpleAPI - process terminating", 4 }, - { "MISSINGVARNAME", "Required varname not specified", 0 }, }; @@ -44,4 +43,4 @@ GBLDEF err_ctl ydberrors_ctl = { 256, "YDB", &ydberrors[0], - 20}; + 19}; diff --git a/sr_unix/dpgbldir_sysops.c b/sr_unix/dpgbldir_sysops.c index 33b5135ea..40541f858 100755 --- a/sr_unix/dpgbldir_sysops.c +++ b/sr_unix/dpgbldir_sysops.c @@ -178,7 +178,7 @@ void dpzgbini(void) uint4 status; parse_blk pblk; - if (NULL != getenv(YDB_GBLDIR)) + if (NULL != getenv(YDB_GBLDIR + 1)) /* + 1 to get past '$' this call doesn't use */ { temp_mstr.addr = YDB_GBLDIR; temp_mstr.len = SIZEOF(YDB_GBLDIR) - 1; diff --git a/sr_unix/gt_timers.c b/sr_unix/gt_timers.c index 51f006fcb..c5a8bcddf 100755 --- a/sr_unix/gt_timers.c +++ b/sr_unix/gt_timers.c @@ -345,7 +345,7 @@ void hiber_start(uint4 hiber) { /* normally, if SIGALRMs are blocked, we must already be inside a timer handler, but someone can actually disable * SIGALRMs, in which case we do not want this assert to trip in pro */ assert(1 <= timer_stack_count); - SLEEP_USEC(hiber * 1000, TRUE); + SLEEP_USEC((long)(hiber * 1000L), TRUE); } else { assertpro(1 > timer_stack_count); /* if SIGALRMs are not blocked, we cannot be inside a timer handler */ diff --git a/sr_unix/gtm_logicals.h b/sr_unix/gtm_logicals.h index b2cd9ddf5..3e0d11bcb 100644 --- a/sr_unix/gtm_logicals.h +++ b/sr_unix/gtm_logicals.h @@ -44,7 +44,7 @@ */ /* YDB Database (YDB versions of above */ #define YDB_GBLDIR "$ydb_gbldir" -#define YDB_ZMAXTPTIME "$ydb_zmaxtptime" +#define YDB_MAXTPTIME "$ydb_maxtptime" /* White-box testing */ #define GTM_WHITE_BOX_TEST_CASE_COUNT "$gtm_white_box_test_case_count" diff --git a/sr_unix/libyottadb.h b/sr_unix/libyottadb.h index ef9d04f34..026f1975b 100755 --- a/sr_unix/libyottadb.h +++ b/sr_unix/libyottadb.h @@ -27,25 +27,24 @@ #include /* For abs() */ /* Enumerated parameter values */ -typedef enum +enum { YDB_DEL_TREE = 1, YDB_DEL_NODE, -} ydb_delete_method; +}; -enum ydb_error_severity +enum { - YDB_ERRSEV_WARNING = 0, /* Warning - Something is potentially incorrect */ - YDB_ERRSEV_SUCCESS = 1, /* Success */ - YDB_ERRSEV_ERROR = 2, /* Error - Something is definitely incorrect */ - YDB_ERRSEV_INFORMATIONAL = 3, /* Informational - won't see these returned as they continue running */ - YDB_ERRSEV_FATAL = 4 /* Fatal - Something happened that is so bad, YottaDB cannot continue */ + YDB_SEVERITY_WARNING = 0, /* Warning - Something is potentially incorrect */ + YDB_SEVERITY_SUCCESS = 1, /* Success */ + YDB_SEVERITY_ERROR = 2, /* Error - Something is definitely incorrect */ + YDB_SEVERITY_INFORMATIONAL = 3, /* Informational - won't see these returned as they continue running */ + YDB_SEVERITY_FATAL = 4 /* Fatal - Something happened that is so bad, YottaDB cannot continue */ }; /* Maximum values */ #define YDB_MAX_IDENT 31 /* Maximum size of global/local name (not including '^') */ -#define YDB_MAX_NAMES 255 /* Maximum number of variable names can be specified in a single ydb_*_s() call */ -/* Note YDB_MAX_NAMES may be temporary and currently only relates to ydb_delete_excl_s() and ydb_tp_s() */ +#define YDB_MAX_NAMES 35 /* Maximum number of variable names can be specified in a single ydb_*_s() call */ #define YDB_MAX_STR (1 * 1024 * 1024) /* Maximum YottaDB string length */ #define YDB_MAX_SUBS 31 /* Maximum subscripts currently supported */ #define YDB_MAX_TIME (0x7fffffffllu * 1000llu * 1000llu) /* Max specified time in (long long) nanoseconds */ @@ -163,13 +162,13 @@ enum ydb_error_severity * errno values do not follow the same rules as YottaDB generated errors so this macro does not work on them. YottaDB * generated errors numbers are all (absolute value) LARGER than 2**27 so anything under that is not supported by this macro. */ -#define YDB_ERROR_SEVERITY(MSGNUM, SEVERITY) \ +#define YDB_SEVERITY(MSGNUM, SEVERITY) \ { \ /* Minor subtrifuge because YDB_OK is 0 (per normal UNIX return code) but the rest of the codes, when the \ * error is out of the range of errno values, have 1 as a success value. \ */ \ if (YDB_OK == (MSGNUM)) \ - SEVERITY = YDB_ERRSEV_SUCCESS; \ + SEVERITY = YDB_SEVERITY_SUCCESS; \ else \ SEVERITY = ((int)abs(MSGNUM) & 7); /* Negation turns msg code into actual code used internally */ \ } @@ -199,8 +198,8 @@ typedef void (*ydb_funcptr_retvoid_t)(); */ typedef struct { - ydb_ulong_t length; - ydb_char_t *address; + unsigned long length; + char *address; } ydb_string_t; /* Structure for interfacing with simple API routines. Meant to be used with the YDB_* macros defined @@ -208,9 +207,9 @@ typedef struct */ typedef struct { - ydb_uint_t len_alloc; - ydb_uint_t len_used; - ydb_char_t *buf_addr; + unsigned int len_alloc; + unsigned int len_used; + char *buf_addr; } ydb_buffer_t; typedef intptr_t ydb_tid_t; /* Timer id */ @@ -223,7 +222,7 @@ typedef void *ydb_fileid_ptr_t; typedef struct { ydb_string_t rtn_name; - void* handle; + void *handle; } ci_name_descriptor; /* Java types with special names for clarity. */ @@ -237,16 +236,16 @@ typedef ydb_char_t ydb_jbyte_array_t; typedef ydb_char_t ydb_jbig_decimal_t; /* Call-in interface. */ -ydb_status_t ydb_ci(const char *c_rtn_name, ...); -ydb_status_t ydb_cip(ci_name_descriptor *ci_info, ...); -ydb_status_t ydb_init(void); -#ifdef GTM_PTHREAD -ydb_status_t ydb_jinit(void); -#endif -ydb_status_t ydb_exit(void); -ydb_status_t ydb_cij(const char *c_rtn_name, char **arg_blob, int count, int *arg_types, unsigned int *io_vars_mask, - unsigned int *has_ret_value); -void ydb_zstatus(char* msg, int len); +int ydb_ci(const char *c_rtn_name, ...); +int ydb_cip(ci_name_descriptor *ci_info, ...); +int ydb_init(void); +# ifdef GTM_PTHREAD +int ydb_jinit(void); +# endif +int ydb_exit(void); +int ydb_cij(const char *c_rtn_name, char **arg_blob, int count, int *arg_types, unsigned int *io_vars_mask, + unsigned int *has_ret_value); +void ydb_zstatus(char* msg, int len); /* Utility entry points accessable in libyottadb.so */ int ydb_file_name_to_id(ydb_string_t *filename, ydb_fileid_ptr_t *fileid); diff --git a/sr_unix/libyottadb_int.h b/sr_unix/libyottadb_int.h index dfbc41aea..3afab1c56 100644 --- a/sr_unix/libyottadb_int.h +++ b/sr_unix/libyottadb_int.h @@ -238,11 +238,11 @@ MBSTART { \ VARLVVALP = (VARTABENTP)->value; \ } MBEND -#define LVUNDEF_OK_FALSE FALSE -#define LVUNDEF_OK_TRUE TRUE +#define ERR_LVUNDEF_OK_FALSE FALSE +#define ERR_LVUNDEF_OK_TRUE TRUE /* Now the NOUPD version */ -#define FIND_BASE_VAR_NOUPD(VARNAMEP, VARMNAMEP, VARTABENTP, VARLVVALP, LVUNDEF_OK) \ +#define FIND_BASE_VAR_NOUPD(VARNAMEP, VARMNAMEP, VARTABENTP, VARLVVALP, ERR_LVUNDEF_OK) \ MBSTART { \ lv_val *lv; \ \ @@ -253,7 +253,7 @@ MBSTART { \ (VARTABENTP) = lookup_hashtab_mname(&curr_symval->h_symtab, (VARMNAMEP)); \ if ((NULL == (VARTABENTP)) || (NULL == (lv_val *)((VARTABENTP)->value))) \ { \ - if (LVUNDEF_OK) \ + if (ERR_LVUNDEF_OK) \ rts_error_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_LVUNDEF); \ else \ VARLVVALP = NULL; \ diff --git a/sr_unix/sleep.h b/sr_unix/sleep.h index 39474e1cf..6dca4c07d 100755 --- a/sr_unix/sleep.h +++ b/sr_unix/sleep.h @@ -3,6 +3,9 @@ * Copyright (c) 2001-2016 Fidelity National Information * * Services, Inc. and/or its subsidiaries. All rights reserved. * * * + * Copyright (c) 2018 YottaDB LLC. and/or its subsidiaries. * + * All rights reserved. * + * * * This source code contains the intellectual property * * of its copyright holder(s), and is made available * * under a license. If you do not know the terms of * @@ -119,7 +122,7 @@ MBSTART { \ \ assert(0 < MICROSECONDS); \ req.tv_sec = (time_t)((MICROSECONDS) / E_6); \ - req.tv_nsec = (long)((usecs = (MICROSECONDS) % E_6) * 1000); /* Assignment! */ \ + req.tv_nsec = (long)((usecs = (MICROSECONDS) % E_6) * 1000L); /* Assignment! */ \ assert(E_9 > req.tv_nsec); \ if (RESTART) \ { \ @@ -127,7 +130,7 @@ MBSTART { \ while ((-1 == (status = nanosleep(&req, NULL))) && (EINTR == errno)) \ { /* This macro will break the loop when it is time. */ \ UPDATE_REM_TIME_OR_BREAK(now, expir, req.tv_sec, usecs); \ - req.tv_nsec = (long)(usecs * 1000); \ + req.tv_nsec = (long)(usecs * 1000L); \ } \ } else \ nanosleep(&req, NULL); \ diff --git a/sr_unix/ydb_data_s.c b/sr_unix/ydb_data_s.c index de64bd35f..b74ed3bd6 100644 --- a/sr_unix/ydb_data_s.c +++ b/sr_unix/ydb_data_s.c @@ -90,9 +90,9 @@ int ydb_data_s(ydb_buffer_t *varname, int subs_used, ydb_buffer_t *subsarray, un { case LYDB_VARREF_LOCAL: /* Find status of the given local variable. Locate base var lv_val in curr_symval */ - FIND_BASE_VAR_NOUPD(varname, &var_mname, tabent, lvvalp, LVUNDEF_OK_FALSE); + FIND_BASE_VAR_NOUPD(varname, &var_mname, tabent, lvvalp, ERR_LVUNDEF_OK_FALSE); if (NULL == lvvalp) - { /* Base local variable does not exist (LVUNDEF_OK_FALSE above is to ensure we do not + { /* Base local variable does not exist (ERR_LVUNDEF_OK_FALSE above is to ensure we do not * issue a LVUNDEF error inside the FIND_BASE_VAR_NOUPD macro). Return 0 for $data result. */ data_value = literal_zero; diff --git a/sr_unix/ydb_delete_excl_s.c b/sr_unix/ydb_delete_excl_s.c index 59e2a53c7..2769fad3f 100644 --- a/sr_unix/ydb_delete_excl_s.c +++ b/sr_unix/ydb_delete_excl_s.c @@ -67,7 +67,9 @@ int ydb_delete_excl_s(int namecount, ydb_buffer_t *varnames) /* If the varname count is zero, this implies a local var kill-all. Check for that before attempting to * validate a name that may not be specified. */ - if (0 >= namecount) + if (0 > namecount) + rts_error_csa(CSA_ARG(NULL) VARLSTCNT(4) ERR_INVNAMECOUNT, 2, RTS_ERROR_LITERAL("ydb_delete_excl_s()")); + if (0 == namecount) { /* Special case - no varname supplied so drive kill-all of local variables */ op_killall(); LIBYOTTADB_DONE; diff --git a/sr_unix/ydb_delete_s.c b/sr_unix/ydb_delete_s.c index 2a19e8b76..b188bda07 100644 --- a/sr_unix/ydb_delete_s.c +++ b/sr_unix/ydb_delete_s.c @@ -90,9 +90,9 @@ int ydb_delete_s(ydb_buffer_t *varname, int subs_used, ydb_buffer_t *subsarray, { case LYDB_VARREF_LOCAL: /* Find status of the given local variable. Locate base var lv_val in curr_symval */ - FIND_BASE_VAR_NOUPD(varname, &var_mname, tabent, lvvalp, LVUNDEF_OK_FALSE); + FIND_BASE_VAR_NOUPD(varname, &var_mname, tabent, lvvalp, ERR_LVUNDEF_OK_FALSE); if (NULL == lvvalp) - { /* Base local variable does not exist (LVUNDEF_OK_FALSE above is to ensure we do not + { /* Base local variable does not exist (ERR_LVUNDEF_OK_FALSE above is to ensure we do not * issue a LVUNDEF error inside the FIND_BASE_VAR_NOUPD macro). Nothing to kill. Return right away. */ break; diff --git a/sr_unix/ydb_get_s.c b/sr_unix/ydb_get_s.c index a6d85783d..ece9ae82b 100644 --- a/sr_unix/ydb_get_s.c +++ b/sr_unix/ydb_get_s.c @@ -92,7 +92,7 @@ int ydb_get_s(ydb_buffer_t *varname, int subs_used, ydb_buffer_t *subsarray, ydb { case LYDB_VARREF_LOCAL: /* Get the given local variable value storing it in the provided buffer (if it fits) */ - FIND_BASE_VAR_NOUPD(varname, &var_mname, tabent, lvvalp, LVUNDEF_OK_TRUE); + FIND_BASE_VAR_NOUPD(varname, &var_mname, tabent, lvvalp, ERR_LVUNDEF_OK_TRUE); /* Locate base var lv_val in curr_symval. Issue LVUNDEF error if base lv does not exist. */ if (0 == subs_used) /* If no subscripts, this is where to fetch the value from (if it exists) */ diff --git a/sr_unix/ydb_lock_s.c b/sr_unix/ydb_lock_s.c index 13d0c0bd1..07603f279 100644 --- a/sr_unix/ydb_lock_s.c +++ b/sr_unix/ydb_lock_s.c @@ -40,17 +40,17 @@ GBLREF volatile int4 outofband; */ int ydb_lock_s(unsigned long long timeout_nsec, int namecount, ...) { - va_list var; - int parmidx, timeoutms, lock_rc; + va_list var, varcpy; + int parmidx, timeoutms, lock_rc, sub_idx, var_svn_index; gparam_list plist; boolean_t error_encountered; mval timeout_mval, varname_mval; mval plist_mvals[YDB_MAX_SUBS + 1]; - ydb_buffer_t *varname, *subsarray; + ydb_buffer_t *varname, *subsarray, *subptr; int subs_used; unsigned long long timeout_msec; ydb_var_types var_type; - int var_svn_index; + char buff[256]; DCL_THREADGBL_ACCESS; SETUP_THREADGBL_ACCESS; @@ -75,6 +75,49 @@ int ydb_lock_s(unsigned long long timeout_nsec, int namecount, ...) rts_error_csa(CSA_ARG(NULL) VARLSTCNT(3) ERR_TIME2LONG, 1, YDB_MAX_TIME); if (0 > namecount) rts_error_csa(CSA_ARG(NULL) VARLSTCNT(4) ERR_INVNAMECOUNT, 2, RTS_ERROR_LITERAL("ydb_lock_s()")); + /* Need to validate all parms before we can do the unlock of all locks held by us */ + VAR_START(var, namecount); + VAR_COPY(varcpy, var); /* Used to validate parms, then var is used to process them */ + for (parmidx = 0; parmidx < namecount; parmidx++) + { /* Simplified version of the processing loop below that validates things */ + varname = va_arg(varcpy, ydb_buffer_t *); + subs_used = va_arg(varcpy, int); + if (0 > subs_used) + { + va_end(varcpy); + rts_error_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_MINNRSUBSCRIPTS); + } + subsarray = va_arg(varcpy, ydb_buffer_t *); + if ((0 < subs_used) && (NULL == subsarray)) + { /* Count of subscripts is non-zero but no subscript specified - error */ + va_end(varcpy); + rts_error_csa(CSA_ARG(NULL) VARLSTCNT(5) ERR_SUBSARRAYNULL, 3, subs_used, LEN_AND_LIT("ydb_lock_s")); + } + /* Validate the varname */ + VALIDATE_VARNAME(varname, var_type, var_svn_index, FALSE); + /* ISV references are not supported for this call */ + if (LYDB_VARREF_ISV == var_type) + { + va_end(varcpy); + rts_error_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_UNIMPLOP); + } + /* Now validate each subscript */ + for (sub_idx = 1, subptr = subsarray; sub_idx <= subs_used; sub_idx++, subptr++) + { /* Pull each subscript descriptor out of param list and put in our parameter buffer. + * A subscript has been specified - copy it to the associated mval and put its address + * in the param list. But before that, do validity checks on input ydb_buffer_t. + */ + if (IS_INVALID_YDB_BUFF_T(subptr)) + { + SPRINTF(buff, "Invalid subsarray (index %d)", subptr - subsarray); + va_end(varcpy); + rts_error_csa(CSA_ARG(NULL) VARLSTCNT(6) ERR_PARAMINVALID, 4, + LEN_AND_STR(buff), LEN_AND_LIT("op_lock_s()")); + } + CHECK_MAX_STR_LEN(subptr); + } + } + va_end(varcpy); /* First step in this routine is to release all the locks */ op_unlock(); if (0 == namecount) @@ -89,21 +132,11 @@ int ydb_lock_s(unsigned long long timeout_nsec, int namecount, ...) * lock block and accumulates these before passing the list to op_lock2 to actually perform the locking. */ varname_mval.mvtype = MV_STR; - VAR_START(var, namecount); for (parmidx = 0; parmidx < namecount; parmidx++) - { - /* Fetch our parms for this lock variable from the parm vector */ + { /* Fetch our parms for this lock variable from the parm vector */ varname = va_arg(var, ydb_buffer_t *); subs_used = va_arg(var, int); subsarray = va_arg(var, ydb_buffer_t *); - /* Validate the varname */ - VALIDATE_VARNAME(varname, var_type, var_svn_index, FALSE); - /* ISV references are not supported for this call */ - if (LYDB_VARREF_ISV == var_type) - { - va_end(var); - rts_error_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_UNIMPLOP); - } plist.arg[0] = NULL; /* First arg is extended reference that simpleAPI doesn't support */ varname_mval.str.addr = varname->buf_addr; /* Second arg is varname */ varname_mval.str.len = varname->len_used; diff --git a/sr_unix/ydb_node_next_s.c b/sr_unix/ydb_node_next_s.c index 08fb3d058..5b3ee2b40 100644 --- a/sr_unix/ydb_node_next_s.c +++ b/sr_unix/ydb_node_next_s.c @@ -91,10 +91,10 @@ int ydb_node_next_s(ydb_buffer_t *varname, int subs_used, ydb_buffer_t *subsarra { case LYDB_VARREF_LOCAL: /* Get the given local variable value storing it in the provided buffer (if it fits) */ - FIND_BASE_VAR_NOUPD(varname, &var_mname, tabent, lvvalp, LVUNDEF_OK_FALSE); /* Locate base lv_val */ + FIND_BASE_VAR_NOUPD(varname, &var_mname, tabent, lvvalp, ERR_LVUNDEF_OK_FALSE); /* Locate base lv_val */ if (NULL == lvvalp) - { /* Base local variable does not exist (LVUNDEF_OK_FALSE above is to ensure we do not - * issue a LVUNDEF error inside the FIND_BASE_VAR_NOUPD macro). + { /* Base local variable does not exist (ERR_LVUNDEF_OK_FALSE above is to ensure + * we do not issue a LVUNDEF error inside the FIND_BASE_VAR_NOUPD macro). * Return 0 for "ydb_node_next_s" result. */ *ret_subs_used = YDB_NODE_END; diff --git a/sr_unix/ydb_node_previous_s.c b/sr_unix/ydb_node_previous_s.c index 4da372863..e1e1da7e7 100644 --- a/sr_unix/ydb_node_previous_s.c +++ b/sr_unix/ydb_node_previous_s.c @@ -91,10 +91,10 @@ int ydb_node_previous_s(ydb_buffer_t *varname, int subs_used, ydb_buffer_t *subs { case LYDB_VARREF_LOCAL: /* Get the given local variable value storing it in the provided buffer (if it fits) */ - FIND_BASE_VAR_NOUPD(varname, &var_mname, tabent, lvvalp, LVUNDEF_OK_FALSE); /* Locate base lv_val */ + FIND_BASE_VAR_NOUPD(varname, &var_mname, tabent, lvvalp, ERR_LVUNDEF_OK_FALSE); /* Locate base lv_val */ if (NULL == lvvalp) - { /* Base local variable does not exist (LVUNDEF_OK_FALSE above is to ensure we do not - * issue a LVUNDEF error inside the FIND_BASE_VAR_NOUPD macro). + { /* Base local variable does not exist (ERR_LVUNDEF_OK_FALSE above is to ensure + * we do not issue a LVUNDEF error inside the FIND_BASE_VAR_NOUPD macro). * Return 0 for "ydb_node_previous_s" result. */ *ret_subs_used = YDB_NODE_END; diff --git a/sr_unix/ydb_subscript_next_s.c b/sr_unix/ydb_subscript_next_s.c index cee9ced26..1d61a7f55 100644 --- a/sr_unix/ydb_subscript_next_s.c +++ b/sr_unix/ydb_subscript_next_s.c @@ -105,11 +105,13 @@ int ydb_subscript_next_s(ydb_buffer_t *varname, int subs_used, ydb_buffer_t *sub * call to op_fnorder(). * - If only one subscript, skip the call to op_srchindx() and just call op_fnorder() with * the single supplied subscript. + * + * First, locate the base lv_val. */ - FIND_BASE_VAR_NOUPD(varname, &var_mname, tabent, lvvalp, LVUNDEF_OK_FALSE); /* Locate base lv_val */ + FIND_BASE_VAR_NOUPD(varname, &var_mname, tabent, lvvalp, ERR_LVUNDEF_OK_FALSE); if (NULL == lvvalp) - { /* Base local variable does not exist (LVUNDEF_OK_FALSE above is to ensure we do not - * issue a LVUNDEF error inside the FIND_BASE_VAR_NOUPD macro). + { /* Base local variable does not exist (ERR_LVUNDEF_OK_FALSE above is to ensure + * we do not issue a LVUNDEF error inside the FIND_BASE_VAR_NOUPD macro). * Return 0 for "ydb_subscript_next_s" result. */ SET_YDB_BUFF_T_FROM_MVAL(ret_value, (mval *)&literal_zero, diff --git a/sr_unix/ydb_subscript_previous_s.c b/sr_unix/ydb_subscript_previous_s.c index 22c948fa8..53994e30d 100644 --- a/sr_unix/ydb_subscript_previous_s.c +++ b/sr_unix/ydb_subscript_previous_s.c @@ -106,11 +106,13 @@ int ydb_subscript_previous_s(ydb_buffer_t *varname, int subs_used, ydb_buffer_t * call to op_fnorder(). * - If only one subscript, skip the call to op_srchindx() and just call op_fnorder() with * the single supplied subscript. + * + * First - locate the base lv_val. */ - FIND_BASE_VAR_NOUPD(varname, &var_mname, tabent, lvvalp, LVUNDEF_OK_FALSE); /* Locate base lv_val */ + FIND_BASE_VAR_NOUPD(varname, &var_mname, tabent, lvvalp, ERR_LVUNDEF_OK_FALSE); if (NULL == lvvalp) - { /* Base local variable does not exist (LVUNDEF_OK_FALSE above is to ensure we do not - * issue a LVUNDEF error inside the FIND_BASE_VAR_NOUPD macro). + { /* Base local variable does not exist (ERR_LVUNDEF_OK_FALSE above is to ensure + * we do not issue a LVUNDEF error inside the FIND_BASE_VAR_NOUPD macro). * Return 0 for "ydb_subscript_previous_s" result. */ SET_YDB_BUFF_T_FROM_MVAL(ret_value, (mval *)&literal_zero, diff --git a/sr_unix/ydb_tp_s.c b/sr_unix/ydb_tp_s.c index f4dd744ec..d60014cce 100644 --- a/sr_unix/ydb_tp_s.c +++ b/sr_unix/ydb_tp_s.c @@ -68,6 +68,8 @@ int ydb_tp_s(ydb_tpfnptr_t tpfn, void *tpfnparm, const char *transid, int nameco /* Check if an outofband action that might care about has popped up */ if (outofband) outofband_action(FALSE); + if (0 > namecount) + rts_error_csa(CSA_ARG(NULL) VARLSTCNT(4) ERR_INVNAMECOUNT, 2, RTS_ERROR_LITERAL("ydb_lock_s()")); save_dollar_tlevel = dollar_tlevel; /* Ready "transid" for passing to "op_tstart" */ tid.mvtype = MV_STR;