summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2010-07-01 11:39:02 -0600
committerRich Megginson <rmeggins@redhat.com>2010-07-01 16:50:41 -0600
commitc88f942bf4c3c804568f840b6dbe97abf10ebf96 (patch)
tree6e90e7c359c6043d5a6cd512e4aad8a7b5314946
parente4ca30c3b247073c0a31a7ba1b356a5b7beb01b4 (diff)
downloadds-bug610177.tar.gz
ds-bug610177.tar.xz
ds-bug610177.zip
Bug 610177 - fix coverity Defect Type: Uninitialized variables issuesbug610177
https://bugzilla.redhat.com/show_bug.cgi?id=610177 Resolves: bug 610177 Bug Description: fix coverity Defect Type: Uninitialized variables issues Reviewed by: nhosoi (Thanks!) Branch: HEAD Fix Description: Initialize variables to 0, NULL, or an appropriate error code. Got rid of the unused lexer code. Platforms tested: RHEL5 x86_64 Flag Day: no Doc impact: no
-rw-r--r--Makefile.am1
-rw-r--r--[-rwxr-xr-x]Makefile.in14
-rw-r--r--include/base/lexer.h126
-rw-r--r--include/libaccess/aclstruct.h2
-rw-r--r--ldap/servers/plugins/bitwise/bitwise.c2
-rw-r--r--ldap/servers/plugins/cos/cos_cache.c6
-rw-r--r--ldap/servers/plugins/replication/repl5_connection.c2
-rw-r--r--ldap/servers/plugins/replication/repl5_inc_protocol.c4
-rw-r--r--ldap/servers/plugins/replication/windows_connection.c4
-rw-r--r--ldap/servers/plugins/replication/windows_protocol_util.c2
-rw-r--r--ldap/servers/plugins/views/views.c2
-rw-r--r--ldap/servers/slapd/back-ldbm/idl.c2
-rw-r--r--ldap/servers/slapd/backend_manager.c2
-rw-r--r--ldap/servers/slapd/mapping_tree.c2
-rw-r--r--ldap/servers/slapd/tools/ldclt/ldapfct.c2
-rw-r--r--lib/base/lexer.cpp1015
-rw-r--r--[-rwxr-xr-x]ltmain.sh0
17 files changed, 15 insertions, 1173 deletions
diff --git a/Makefile.am b/Makefile.am
index 67ccd0f2..24fdd0ea 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -533,7 +533,6 @@ libns_dshttpd_la_SOURCES = lib/libaccess/access_plhash.cpp \
lib/base/ereport.cpp \
lib/base/file.cpp \
lib/base/fsmutex.cpp \
- lib/base/lexer.cpp \
lib/base/net.cpp \
lib/base/nscperror.c \
lib/base/plist.cpp \
diff --git a/Makefile.in b/Makefile.in
index 0bab8528..23cbdcf6 100755..100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -335,7 +335,6 @@ am_libns_dshttpd_la_OBJECTS = \
lib/base/libns_dshttpd_la-ereport.lo \
lib/base/libns_dshttpd_la-file.lo \
lib/base/libns_dshttpd_la-fsmutex.lo \
- lib/base/libns_dshttpd_la-lexer.lo \
lib/base/libns_dshttpd_la-net.lo \
lib/base/libns_dshttpd_la-nscperror.lo \
lib/base/libns_dshttpd_la-plist.lo \
@@ -1608,7 +1607,6 @@ libns_dshttpd_la_SOURCES = lib/libaccess/access_plhash.cpp \
lib/base/ereport.cpp \
lib/base/file.cpp \
lib/base/fsmutex.cpp \
- lib/base/lexer.cpp \
lib/base/net.cpp \
lib/base/nscperror.c \
lib/base/plist.cpp \
@@ -3156,8 +3154,6 @@ lib/base/libns_dshttpd_la-file.lo: lib/base/$(am__dirstamp) \
lib/base/$(DEPDIR)/$(am__dirstamp)
lib/base/libns_dshttpd_la-fsmutex.lo: lib/base/$(am__dirstamp) \
lib/base/$(DEPDIR)/$(am__dirstamp)
-lib/base/libns_dshttpd_la-lexer.lo: lib/base/$(am__dirstamp) \
- lib/base/$(DEPDIR)/$(am__dirstamp)
lib/base/libns_dshttpd_la-net.lo: lib/base/$(am__dirstamp) \
lib/base/$(DEPDIR)/$(am__dirstamp)
lib/base/libns_dshttpd_la-nscperror.lo: lib/base/$(am__dirstamp) \
@@ -5084,8 +5080,6 @@ mostlyclean-compile:
-rm -f lib/base/libns_dshttpd_la-file.lo
-rm -f lib/base/libns_dshttpd_la-fsmutex.$(OBJEXT)
-rm -f lib/base/libns_dshttpd_la-fsmutex.lo
- -rm -f lib/base/libns_dshttpd_la-lexer.$(OBJEXT)
- -rm -f lib/base/libns_dshttpd_la-lexer.lo
-rm -f lib/base/libns_dshttpd_la-net.$(OBJEXT)
-rm -f lib/base/libns_dshttpd_la-net.lo
-rm -f lib/base/libns_dshttpd_la-nscperror.$(OBJEXT)
@@ -5587,7 +5581,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@lib/base/$(DEPDIR)/libns_dshttpd_la-ereport.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@lib/base/$(DEPDIR)/libns_dshttpd_la-file.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@lib/base/$(DEPDIR)/libns_dshttpd_la-fsmutex.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@lib/base/$(DEPDIR)/libns_dshttpd_la-lexer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@lib/base/$(DEPDIR)/libns_dshttpd_la-net.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@lib/base/$(DEPDIR)/libns_dshttpd_la-nscperror.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@lib/base/$(DEPDIR)/libns_dshttpd_la-plist.Plo@am__quote@
@@ -9265,13 +9258,6 @@ lib/base/libns_dshttpd_la-fsmutex.lo: lib/base/fsmutex.cpp
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libns_dshttpd_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lib/base/libns_dshttpd_la-fsmutex.lo `test -f 'lib/base/fsmutex.cpp' || echo '$(srcdir)/'`lib/base/fsmutex.cpp
-lib/base/libns_dshttpd_la-lexer.lo: lib/base/lexer.cpp
-@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libns_dshttpd_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lib/base/libns_dshttpd_la-lexer.lo -MD -MP -MF "lib/base/$(DEPDIR)/libns_dshttpd_la-lexer.Tpo" -c -o lib/base/libns_dshttpd_la-lexer.lo `test -f 'lib/base/lexer.cpp' || echo '$(srcdir)/'`lib/base/lexer.cpp; \
-@am__fastdepCXX_TRUE@ then mv -f "lib/base/$(DEPDIR)/libns_dshttpd_la-lexer.Tpo" "lib/base/$(DEPDIR)/libns_dshttpd_la-lexer.Plo"; else rm -f "lib/base/$(DEPDIR)/libns_dshttpd_la-lexer.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lib/base/lexer.cpp' object='lib/base/libns_dshttpd_la-lexer.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libns_dshttpd_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lib/base/libns_dshttpd_la-lexer.lo `test -f 'lib/base/lexer.cpp' || echo '$(srcdir)/'`lib/base/lexer.cpp
-
lib/base/libns_dshttpd_la-net.lo: lib/base/net.cpp
@am__fastdepCXX_TRUE@ if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libns_dshttpd_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lib/base/libns_dshttpd_la-net.lo -MD -MP -MF "lib/base/$(DEPDIR)/libns_dshttpd_la-net.Tpo" -c -o lib/base/libns_dshttpd_la-net.lo `test -f 'lib/base/net.cpp' || echo '$(srcdir)/'`lib/base/net.cpp; \
@am__fastdepCXX_TRUE@ then mv -f "lib/base/$(DEPDIR)/libns_dshttpd_la-net.Tpo" "lib/base/$(DEPDIR)/libns_dshttpd_la-net.Plo"; else rm -f "lib/base/$(DEPDIR)/libns_dshttpd_la-net.Tpo"; exit 1; fi
diff --git a/include/base/lexer.h b/include/base/lexer.h
deleted file mode 100644
index e8fd8bb9..00000000
--- a/include/base/lexer.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * This Program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation; version 2 of the License.
- *
- * This Program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception.
- *
- *
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifndef __lexer_h
-#define __lexer_h
-
-#ifndef _POOL_H_
-#include "base/pool.h"
-#endif /* _POOL_H_ */
-
-/* Define error codes */
-#define LEXERR_MALLOC -1 /* insufficient dynamic memory */
-
-
-typedef struct LEXStream_s LEXStream_t;
-typedef int (*LEXStreamGet_t)(LEXStream_t *);
-struct LEXStream_s {
- LEXStream_t * lst_next; /* link for "include" parent stream */
- void * lst_strmid; /* client stream identifier */
- LEXStreamGet_t lst_get; /* pointer to stream "get" function */
- char * lst_buf; /* stream buffer pointer */
- char * lst_cp; /* current position in buffer */
- int lst_len; /* remaining bytes in buffer */
- int lst_buflen; /* buffer length */
- int lst_flags; /* bit flags */
-#define LST_FREEBUF 0x1 /* free lst_buf in stream destroy */
-};
-NSPR_BEGIN_EXTERN_C
-
-/* Functions in lexer.c */
-NSAPI_PUBLIC
-int lex_class_check(void * chtab, char code, unsigned long cbits);
-
-NSAPI_PUBLIC
-int lex_class_create(int classc, char * classv[], void **pchtab);
-
-NSAPI_PUBLIC void lex_class_destroy(void * chtab);
-
-NSAPI_PUBLIC
-LEXStream_t * lex_stream_create(LEXStreamGet_t strmget, void * strmid,
- char * buf, int buflen);
-
-NSAPI_PUBLIC void lex_stream_destroy(LEXStream_t * lst);
-
-NSAPI_PUBLIC int
-lex_token_new(pool_handle_t * pool, int initlen, int growlen, void **token);
-
-NSAPI_PUBLIC int lex_token_start(void * token);
-
-NSAPI_PUBLIC
-char * lex_token_info(void * token, int * tdatalen, int * tbufflen);
-
-NSAPI_PUBLIC char * lex_token(void * token);
-
-NSAPI_PUBLIC void lex_token_destroy(void * token);
-
-NSAPI_PUBLIC
-char * lex_token_get(void * token, int * tdatalen, int * tbufflen);
-
-NSAPI_PUBLIC char * lex_token_take(void * token);
-
-NSAPI_PUBLIC
-int lex_token_append(void * token, int nbytes, char * src);
-
-NSAPI_PUBLIC
-int lex_next_char(LEXStream_t * lst, void * chtab, unsigned long cbits);
-
-NSAPI_PUBLIC
-int lex_scan_over(LEXStream_t * lst, void * chtab, unsigned long cbits,
- void * token);
-
-NSAPI_PUBLIC
-int lex_scan_string(LEXStream_t * lst, void * token, int flags);
-
-NSAPI_PUBLIC
-int lex_scan_to(LEXStream_t * lst, void * chtab, unsigned long cbits,
- void * token);
-
-NSAPI_PUBLIC
-int lex_skip_over(LEXStream_t * lst, void * chtab, unsigned long cbits);
-
-NSAPI_PUBLIC
-int lex_skip_to(LEXStream_t * lst, void * chtab, unsigned long cbits);
-
-NSPR_END_EXTERN_C
-
-#endif /* __lexer_h */
diff --git a/include/libaccess/aclstruct.h b/include/libaccess/aclstruct.h
index 6d464ffc..9f5da250 100644
--- a/include/libaccess/aclstruct.h
+++ b/include/libaccess/aclstruct.h
@@ -52,7 +52,6 @@
#include "base/systems.h"
#include "base/file.h"
-#include "base/lexer.h"
#include "nsauth.h" /* authentication types */
#include "symbols.h" /* typed symbol support */
#include "ipfstruct.h" /* IP address filter structures */
@@ -288,7 +287,6 @@ typedef struct ACLFile_s ACLFile_t;
struct ACLFile_s {
ACLFile_t * acf_next; /* list link */
char * acf_filename; /* pointer to filename string */
- LEXStream_t * acf_lst; /* LEX stream handle */
SYS_FILE acf_fd; /* file descriptor */
int acf_flags; /* bit flags (unused) */
int acf_lineno; /* current line number */
diff --git a/ldap/servers/plugins/bitwise/bitwise.c b/ldap/servers/plugins/bitwise/bitwise.c
index 01c05fd2..190e26df 100644
--- a/ldap/servers/plugins/bitwise/bitwise.c
+++ b/ldap/servers/plugins/bitwise/bitwise.c
@@ -123,7 +123,7 @@ internal_bitwise_filter_match(void* obj, Slapi_Entry* entry, Slapi_Attr* attr, i
if (errno == ERANGE) {
rc = LDAP_CONSTRAINT_VIOLATION;
} else {
- int result;
+ int result = 0;
/* The Microsoft Windows AD bitwise operators do not work exactly
as the plain old C bitwise operators work. For the AND case
the matching rule is true only if all bits from the given value
diff --git a/ldap/servers/plugins/cos/cos_cache.c b/ldap/servers/plugins/cos/cos_cache.c
index b5aace63..bc79ee5c 100644
--- a/ldap/servers/plugins/cos/cos_cache.c
+++ b/ldap/servers/plugins/cos/cos_cache.c
@@ -1101,7 +1101,7 @@ static int cos_dn_defs_cb (Slapi_Entry* e, void *callback_data) {
static int cos_cache_add_dn_defs(char *dn, cosDefinitions **pDefs, int *vattr_cacheable)
{
Slapi_PBlock *pDnSearch = 0;
- struct dn_defs_info info;
+ struct dn_defs_info info = {NULL, 0, 0};
pDnSearch = slapi_pblock_new();
if (pDnSearch) {
info.ret=-1; /* assume no good defs */
@@ -1314,7 +1314,7 @@ static int cos_cache_add_dn_tmpls(char *dn, cosAttrValue *pCosSpecifier, cosAttr
{
void *plugin_id;
int scope;
- struct tmpl_info info;
+ struct tmpl_info info = {NULL, 0, 0};
Slapi_PBlock *pDnSearch = 0;
LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_add_dn_tmpls\n",0,0,0);
@@ -1714,7 +1714,7 @@ int cos_cache_getref(cos_cache **pptheCache)
*/
int cos_cache_addref(cos_cache *ptheCache)
{
- int ret;
+ int ret = 0;
cosCache *pCache = (cosCache*)ptheCache;
LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_addref\n",0,0,0);
diff --git a/ldap/servers/plugins/replication/repl5_connection.c b/ldap/servers/plugins/replication/repl5_connection.c
index bd285184..aacdc557 100644
--- a/ldap/servers/plugins/replication/repl5_connection.c
+++ b/ldap/servers/plugins/replication/repl5_connection.c
@@ -639,7 +639,7 @@ perform_operation(Repl_Connection *conn, int optype, const char *dn,
int deleteoldrdn, LDAPControl *update_control,
const char *extop_oid, struct berval *extop_payload, int *message_id)
{
- int rc;
+ int rc = -1;
ConnResult return_value = CONN_OPERATION_FAILED;
LDAPControl *server_controls[3];
/* LDAPControl **loc_returned_controls; */
diff --git a/ldap/servers/plugins/replication/repl5_inc_protocol.c b/ldap/servers/plugins/replication/repl5_inc_protocol.c
index 6475eb89..e4c6e2bd 100644
--- a/ldap/servers/plugins/replication/repl5_inc_protocol.c
+++ b/ldap/servers/plugins/replication/repl5_inc_protocol.c
@@ -1384,7 +1384,7 @@ reset_events (Private_Repl_Protocol *prp)
ConnResult
replay_update(Private_Repl_Protocol *prp, slapi_operation_parameters *op, int *message_id)
{
- ConnResult return_value;
+ ConnResult return_value = CONN_OPERATION_FAILED;
LDAPControl *update_control;
char *parentuniqueid;
LDAPMod **modrdn_mods = NULL;
@@ -2202,7 +2202,7 @@ examine_update_vector(Private_Repl_Protocol *prp, RUV *remote_ruv)
static PRBool
ignore_error_and_keep_going(int error)
{
- int return_value;
+ int return_value = PR_FALSE;
switch (error)
{
diff --git a/ldap/servers/plugins/replication/windows_connection.c b/ldap/servers/plugins/replication/windows_connection.c
index a1e74c44..8aabfdbb 100644
--- a/ldap/servers/plugins/replication/windows_connection.c
+++ b/ldap/servers/plugins/replication/windows_connection.c
@@ -306,7 +306,7 @@ windows_perform_operation(Repl_Connection *conn, int optype, const char *dn,
const char *extop_oid, struct berval *extop_payload, char **retoidp,
struct berval **retdatap, LDAPControl ***returned_controls)
{
- int rc = LDAP_SUCCESS;
+ int rc = -1;
ConnResult return_value;
LDAPControl **loc_returned_controls;
const char *op_string = NULL;
@@ -316,7 +316,7 @@ windows_perform_operation(Repl_Connection *conn, int optype, const char *dn,
if (windows_conn_connected(conn))
{
- int msgid;
+ int msgid = -2; /* should match no messages */
conn->last_operation = optype;
switch (optype)
diff --git a/ldap/servers/plugins/replication/windows_protocol_util.c b/ldap/servers/plugins/replication/windows_protocol_util.c
index 65de19dd..3c6b4d4c 100644
--- a/ldap/servers/plugins/replication/windows_protocol_util.c
+++ b/ldap/servers/plugins/replication/windows_protocol_util.c
@@ -1640,7 +1640,7 @@ is_straight_mapped_attr(const char *type, int is_user /* or group */, int is_nt4
static int
is_single_valued_attr(const char *type)
{
- int found;
+ int found = 0;
size_t offset = 0;
char *this_attr = NULL;
diff --git a/ldap/servers/plugins/views/views.c b/ldap/servers/plugins/views/views.c
index a6646d89..4a884b79 100644
--- a/ldap/servers/plugins/views/views.c
+++ b/ldap/servers/plugins/views/views.c
@@ -1296,7 +1296,7 @@ static int views_dn_views_cb (Slapi_Entry* e, void *callback_data) {
static int views_cache_add_dn_views(char *dn, viewEntry **pViews)
{
Slapi_PBlock *pDnSearch = 0;
- struct dn_views_info info;
+ struct dn_views_info info = {NULL, -1};
pDnSearch = slapi_pblock_new();
if (pDnSearch) {
info.ret=-1;
diff --git a/ldap/servers/slapd/back-ldbm/idl.c b/ldap/servers/slapd/back-ldbm/idl.c
index be564467..ca370768 100644
--- a/ldap/servers/slapd/back-ldbm/idl.c
+++ b/ldap/servers/slapd/back-ldbm/idl.c
@@ -1272,7 +1272,7 @@ void idl_insert(IDList **idl, ID id)
static int
idl_insert_maxids( IDList **idl, ID id, int maxids )
{
- ID i, j;
+ ID i = 0, j = 0;
NIDS nids;
if ( ALLIDS( *idl ) ) {
diff --git a/ldap/servers/slapd/backend_manager.c b/ldap/servers/slapd/backend_manager.c
index 6456f299..98d9a961 100644
--- a/ldap/servers/slapd/backend_manager.c
+++ b/ldap/servers/slapd/backend_manager.c
@@ -391,7 +391,7 @@ be_unbindall(Connection *conn, Operation *op)
if ( plugin_call_plugins( &pb, SLAPI_PLUGIN_PRE_UNBIND_FN ) == 0 )
{
- int rc;
+ int rc = 0;
slapi_pblock_set( &pb, SLAPI_PLUGIN, backends[i]->be_database );
if(backends[i]->be_state != BE_STATE_DELETED &&
backends[i]->be_unbind!=NULL)
diff --git a/ldap/servers/slapd/mapping_tree.c b/ldap/servers/slapd/mapping_tree.c
index a67ec2ac..f24c9189 100644
--- a/ldap/servers/slapd/mapping_tree.c
+++ b/ldap/servers/slapd/mapping_tree.c
@@ -613,7 +613,7 @@ mapping_tree_entry_add(Slapi_Entry *entry, mapping_tree_node **newnodep )
Slapi_DN *subtree = NULL;
const char *tmp_ndn;
int be_list_count = 0;
- int be_list_size;
+ int be_list_size = 0;
backend **be_list = NULL;
char **be_names = NULL;
int * be_states = NULL;
diff --git a/ldap/servers/slapd/tools/ldclt/ldapfct.c b/ldap/servers/slapd/tools/ldclt/ldapfct.c
index b19c6895..cecaf3a5 100644
--- a/ldap/servers/slapd/tools/ldclt/ldapfct.c
+++ b/ldap/servers/slapd/tools/ldclt/ldapfct.c
@@ -2238,7 +2238,7 @@ getPending (
{
LDAPMessage *res; /* LDAP async results */
int ret; /* Return values */
- int expected; /* Expect this type */
+ int expected = 0; /* Expect this type */
char *verb; /* LDAP verb expected */
int type; /* Message type */
int errcodep; /* Async error code */
diff --git a/lib/base/lexer.cpp b/lib/base/lexer.cpp
deleted file mode 100644
index 237edf0d..00000000
--- a/lib/base/lexer.cpp
+++ /dev/null
@@ -1,1015 +0,0 @@
-/** BEGIN COPYRIGHT BLOCK
- * This Program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation; version 2 of the License.
- *
- * This Program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * In addition, as a special exception, Red Hat, Inc. gives You the additional
- * right to link the code of this Program with code not covered under the GNU
- * General Public License ("Non-GPL Code") and to distribute linked combinations
- * including the two, subject to the limitations in this paragraph. Non-GPL Code
- * permitted under this exception must only link to the code of this Program
- * through those well defined interfaces identified in the file named EXCEPTION
- * found in the source code files (the "Approved Interfaces"). The files of
- * Non-GPL Code may instantiate templates or use macros or inline functions from
- * the Approved Interfaces without causing the resulting work to be covered by
- * the GNU General Public License. Only Red Hat, Inc. may make changes or
- * additions to the list of Approved Interfaces. You must obey the GNU General
- * Public License in all respects for all of the Program code and other code used
- * in conjunction with the Program except the Non-GPL Code covered by this
- * exception. If you modify this file, you may extend this exception to your
- * version of the file, but you are not obligated to do so. If you do not wish to
- * provide this exception without modification, you must delete this exception
- * statement from your version and license this file solely under the GPL without
- * exception.
- *
- *
- * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- * Copyright (C) 2005 Red Hat, Inc.
- * All rights reserved.
- * END COPYRIGHT BLOCK **/
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-
-/*
- * Description (lexer.c)
- *
- * This module provides functions to assist parsers in lexical
- * analysis. The idea is to provide a slightly higher-level
- * interface than that of ctype.h.
- */
-
-#include "netsite.h"
-#include "prlog.h"
-
-#include "lexer_pvt.h"
-#include "base/lexer.h"
-
-/*
- * Description (lex_class_check)
- *
- * This function checks whether a given character belongs to one or
- * specified character classes.
- *
- * Arguments:
- *
- * chtab - character class table pointer
- * code - character code to be tested
- * cbits - bit mask of character classes
- *
- * Returns:
- *
- * The return value is zero if the code is not in any of the character
- * classes. It is non-zero, if the code is in at least one of the
- * classes.
- */
-NSAPI_PUBLIC
-int lex_class_check(void * chtab, char code, unsigned long cbits)
-{
- LEXClassTab_t * lct; /* character class table pointer */
- unsigned char * bp; /* bit vector pointer */
- int rv = 0; /* return value */
- int i; /* loop index */
-
- lct = (LEXClassTab_t *)chtab;
-
- bp = lct->lct_bv + code * lct->lct_bvbytes;
-
- for (i = 0; i < lct->lct_bvbytes; ++i) {
- if (*bp++ & cbits) {
- rv = 1;
- break;
- }
- cbits >>= 8;
- }
-
- return rv;
-}
-
-/*
- * Description (lex_class_create)
- *
- * This function creates a new character class table. A
- * character class table is used to map a character code to a
- * set of character classes. The mapping for a given character
- * is expressed as a bit vector, where each bit indicates the
- * membership of that character in one of the character classes.
- *
- * Arguments:
- *
- * classc - the number of character classes being defined
- * classv - pointers to null-terminated strings containing
- * the character codes in each character class
- * pchtab - indicates where to store a returned handle for
- * the character class table
- *
- * Returns:
- *
- * If successful, the return value is the number of character
- * classes specified (classc), and a handle for the created table
- * is returned through pchtab.
- *
- * Usage Notes:
- *
- * Null (\000) can never be in any character classes, since it
- * marks the end of the classv[] strings.
- *
- * classv[] can included NULL pointers, in which case bits will be
- * allocated for corresponding empty character classes.
- */
-NSAPI_PUBLIC
-int lex_class_create(int classc, char * classv[], void **pchtab)
-{
- int ncodes = 128; /* number of character encodings */
- int bvbytes; /* bytes per bit vector */
- LEXClassTab_t * ct; /* class table pointer */
- unsigned char * bp; /* bit vector pointer */
- char * cp; /* class string pointer */
- int bitmask; /* class bit mask */
- int bnum; /* byte number in bit vector */
- int ci; /* character index */
- int i; /* class index */
-
- /* Get number of bytes per bit vector */
- PR_ASSERT(classc > 0);
- bvbytes = (classc + 7) >> 3;
-
- /* Allocate the character class table */
- ct = (LEXClassTab_t *)calloc(1, sizeof(LEXClassTab_t) + ncodes * bvbytes);
- if (ct == NULL) {
-
- /* Error - insufficient memory */
- return LEXERR_MALLOC;
- }
-
- /* Initialize the class table */
- ct->lct_classc = classc;
- ct->lct_bvbytes = bvbytes;
- ct->lct_bv = (unsigned char *)(ct + 1);
-
- /* Initialize the bit vectors */
- for (i = 0; i < classc; ++i) {
-
- cp = classv[i];
- if (cp != NULL) {
-
- bitmask = 1 << (i & 7);
- bnum = i >> 7;
-
- while ((ci = *cp++) != 0) {
- bp = ct->lct_bv + ci + bnum;
- *bp |= bitmask;
- }
- }
- }
-
- /* Return pointer to table */
- PR_ASSERT(pchtab != NULL);
- *pchtab = (void *)ct;
-
- return classc;
-}
-
-NSAPI_PUBLIC
-void lex_class_destroy(void * chtab)
-{
- FREE((void *)chtab);
-}
-
-NSAPI_PUBLIC
-LEXStream_t * lex_stream_create(LEXStreamGet_t strmget, void * strmid,
- char * buf, int buflen)
-{
- LEXStream_t * lst; /* stream structure pointer */
-
- /* Allocate the stream structure */
- lst = (LEXStream_t *)MALLOC(sizeof(LEXStream_t));
- if (lst == NULL) {
- /* Error - insufficient memory */
- return 0;
- }
-
- lst->lst_strmid = strmid;
- lst->lst_get = strmget;
-
- /*
- * Allocate a buffer for the stream if there's a positive length
- * but a NULL buffer pointer.
- */
- if ((buflen > 0) && (buf == NULL)) {
-
- buf = (char *)MALLOC(buflen);
- if (buf == NULL) {
- FREE((void *)lst);
- return 0;
- }
-
- /* Also initialize the current position and residual length */
- lst->lst_cp = buf;
- lst->lst_len = 0;
- lst->lst_flags = LST_FREEBUF;
- }
-
- lst->lst_buf = buf;
- lst->lst_buflen = buflen;
-
- return lst;
-}
-
-NSAPI_PUBLIC
-void lex_stream_destroy(LEXStream_t * lst)
-{
- if ((lst->lst_flags & LST_FREEBUF) && (lst->lst_buf != NULL)) {
- FREE(lst->lst_buf);
- }
- FREE((void *)lst);
-}
-
-/*
- * Description (lex_token_new)
- *
- * This function creates a new token object. A token object is
- * used to accumulate text in an associated buffer. If the
- * 'growlen' argument is specified as a value that is greater
- * than zero, then the token buffer will be reallocated as
- * necessary to accomodate more text. The initial size of
- * the token buffer is given by 'initlen', which may be zero,
- * and should be zero if lex_token_setbuf() is used.
- *
- * The token object is allocated from the memory pool given
- * by the 'pool' argument. The default pool for the current
- * thread is used if 'pool' is null.
- *
- * Arguments:
- *
- * pool - handle for memory pool to be used
- * initlen - initial length of token buffer
- * growlen - amount to grow a full token buffer
- * token - pointer to returned token handle
- *
- * Returns:
- *
- * If successful, the function return value is zero and a handle
- * for the new token is returned via 'token'. Otherwise a negative
- * error code is returned.
- */
-
-NSAPI_PUBLIC
-int lex_token_new(pool_handle_t * pool, int initlen, int growlen, void **token)
-{
- LEXToken_t * lt; /* new token pointer */
-
- /* Allocate the token structure */
- if (pool) {
- lt = (LEXToken_t *)pool_calloc(pool, 1, sizeof(LEXToken_t));
- }
- else {
- lt = (LEXToken_t *)CALLOC(sizeof(LEXToken_t));
- }
- if (lt == NULL) {
- /* Error - insufficient memory */
- return LEXERR_MALLOC;
- }
-
- /* Save the memory pool handle for future allocations */
- lt->lt_mempool = pool;
-
- /* Allocate the initial token buffer if initlen > 0 */
- if (initlen > 0) {
- if (pool) {
- lt->lt_buf = (char *)pool_malloc(pool, initlen);
- }
- else {
- lt->lt_buf = (char *)MALLOC(initlen);
- }
- if (lt->lt_buf == NULL) {
- /* Error - insufficient memory */
- if (pool) {
- pool_free(pool, (void *)lt);
- }
- else {
- FREE((void *)lt);
- }
- return LEXERR_MALLOC;
- }
-
- lt->lt_initlen = initlen;
- lt->lt_buflen = initlen;
- lt->lt_buf[0] = 0;
- }
-
- if (growlen > 0) lt->lt_inclen = growlen;
-
- PR_ASSERT(token != NULL);
- *token = (void *)lt;
-
- return 0;
-}
-
-/*
- * Description (lex_token_start)
- *
- * This function discards any current contents of the token buffer
- * associated with a specified token object, so that any new data
- * appended to the token will start at the beginning of the token
- * buffer. If there is no token buffer currently associated with
- * the token, and the 'initlen' value specified to lex_token_new()
- * was greater than zero, then a new token buffer is allocated.
- * This function enables a token and optionally its token buffer
- * to be reused.
- *
- * Arguments:
- *
- * token - handle for token object
- *
- * Returns:
- *
- * If successful, the function return value is zero. Otherwise
- * a negative error code is returned.
- */
-
-NSAPI_PUBLIC int
-lex_token_start(void * token)
-{
- LEXToken_t * lt = (LEXToken_t *)token; /* token pointer */
-
- /* Do we need to allocate a token buffer? */
- if ((lt->lt_buf == NULL) && (lt->lt_initlen > 0)) {
-
- /* Allocate the initial token buffer */
- if (lt->lt_mempool) {
- lt->lt_buf = (char *)pool_malloc(lt->lt_mempool, lt->lt_initlen);
- }
- else {
- lt->lt_buf = (char *)MALLOC(lt->lt_initlen);
- }
- if (lt->lt_buf == NULL) {
- /* Error - insufficient memory */
- return LEXERR_MALLOC;
- }
- lt->lt_buflen = lt->lt_initlen;
- }
-
- lt->lt_len = 0;
- lt->lt_buf[0] = 0;
-
- return 0;
-}
-
-/*
- * Description (lex_token_info)
- *
- * This function returns information about the token buffer currently
- * associated with a token object. This includes a pointer to the
- * token data, if any, the current length of the token data, and the
- * current size of the token buffer.
- *
- * Arguments:
- *
- * token - handle for token object
- * tdatalen - pointer to returned token data length
- * (may be null)
- * tbufflen - pointer to returned token buffer length
- * (may be null)
- *
- * Returns:
- *
- * The function return value is a pointer to the beginning of the
- * token data, or null if there is no token buffer associated with
- * the token. The token data length and token buffer length are
- * returned via 'tdatalen' and 'tbufflen', respectively.
- */
-
-NSAPI_PUBLIC
-char * lex_token_info(void * token, int * tdatalen, int * tbufflen)
-{
- LEXToken_t * lt = (LEXToken_t *)token; /* token pointer */
-
- if (tdatalen) *tdatalen = lt->lt_len;
- if (tbufflen) *tbufflen = lt->lt_buflen;
-
- return lt->lt_buf;
-}
-
-/*
- * Description (lex_token)
- *
- * This function returns a pointer to the current token buffer, if any.
- * If the length of the token is also needed, use lex_token_info().
- * This function would normally be used when the token is a
- * null-terminated string. See also lex_token_take().
- *
- * Arguments:
- *
- * token - handle for token object
- *
- * Returns:
- *
- * A pointer to the beginning of the current token is returned.
- * The pointer is null if no token buffer is currently associated
- * with the token object.
- */
-
-NSAPI_PUBLIC
-char * lex_token(void * token)
-{
- LEXToken_t * lt = (LEXToken_t *)token; /* token pointer */
-
- return lt->lt_buf;
-}
-
-/*
- * Description (lex_token_destroy)
- *
- * This function destroys a specified token object. The memory
- * associated with the token object and its token buffer, if any,
- * is freed to whence it came. Note that token objects can be
- * associated with a memory pool, and destroyed implicitly when
- * the pool is destroyed via pool_destroy().
- *
- * Arguments:
- *
- * token - handle for token object
- */
-
-NSAPI_PUBLIC
-void lex_token_destroy(void * token)
-{
- LEXToken_t * lt = (LEXToken_t *)token; /* token pointer */
-
- if (lt) {
- if (lt->lt_mempool) {
- if (lt->lt_buf) {
- pool_free(lt->lt_mempool, (void *)(lt->lt_buf));
- }
- pool_free(lt->lt_mempool, (void *)lt);
- }
- else {
- if (lt->lt_buf) {
- FREE(lt->lt_buf);
- }
- FREE(lt);
- }
- }
-}
-
-/*
- * Description (lex_token_get)
- *
- * This function returns a pointer to the current token buffer,
- * leaving the token with no associated token buffer. The caller
- * assumes ownership of the returned token buffer. The length
- * of the token data and the length of the token buffer are returned
- * if requested. Note that lex_token_take() performs a similar
- * operation.
- *
- * Arguments:
- *
- * token - handle for token object
- * tdatalen - pointer to returned token data length
- * (may be null)
- * tbufflen - pointer to returned token buffer length
- * (may be null)
- *
- * Returns:
- *
- * The function return value is a pointer to the beginning of the
- * token data, or null if there is no token buffer associated with
- * the token. The token data length and token buffer length are
- * returned via 'tdatalen' and 'tbufflen', respectively.
- */
-
-NSAPI_PUBLIC
-char * lex_token_get(void * token, int * tdatalen, int * tbufflen)
-{
- LEXToken_t * lt = (LEXToken_t *)token; /* token pointer */
- char * tokenstr;
-
- tokenstr = lt->lt_buf;
- if (tdatalen) *tdatalen = lt->lt_len;
- if (tbufflen) *tbufflen = lt->lt_buflen;
-
- lt->lt_buf = NULL;
- lt->lt_buflen = 0;
- lt->lt_len = 0;
-
- return tokenstr;
-}
-
-/*
- * Description (lex_token_take)
- *
- * This function returns a pointer to the current token buffer,
- * leaving the token with no associated token buffer. The caller
- * assumes ownership of the returned token buffer. Note that
- * lex_token_get() performs a similar operation, but returns more
- * information.
- *
- * Arguments:
- *
- * token - handle for token object
- *
- * Returns:
- *
- * A pointer to the beginning of the current token is returned.
- * The pointer is null if no token buffer is currently associated
- * with the token object.
- */
-
-NSAPI_PUBLIC
-char * lex_token_take(void * token)
-{
- LEXToken_t * lt = (LEXToken_t *)token; /* token pointer */
- char * tokenstr;
-
- tokenstr = lt->lt_buf;
-
- lt->lt_buf = NULL;
- lt->lt_buflen = 0;
- lt->lt_len = 0;
-
- return tokenstr;
-}
-
-/*
- * Description (lex_token_append)
- *
- * This function appends data to the end of a token. If 'growlen'
- * was specified as a greater-than-zero value for lex_token_new(),
- * then the token buffer may be reallocated to accomodate the
- * new data if necessary. A null byte is maintained in the token
- * buffer following the token data, but it is not included in the
- * token data length.
- *
- * Arguments:
- *
- * token - handle for token object
- * nbytes - number of bytes of new data
- * src - pointer to new data
- *
- * Returns:
- *
- * If successful, the function return value is the new length of
- * the token data. Otherwise a negative error code is returned.
- */
-
-NSAPI_PUBLIC
-int lex_token_append(void * token, int nbytes, char * src)
-{
- LEXToken_t * lt = (LEXToken_t *)token; /* token pointer */
- int bufsize;
- int length;
-
- PR_ASSERT(nbytes >= 0);
- PR_ASSERT((src != NULL) || (nbytes == 0));
-
- if (nbytes > 0) {
-
- bufsize = lt->lt_buflen;
- length = lt->lt_len + nbytes;
-
- if (length >= bufsize) {
-
- while (length >= bufsize) {
- bufsize += lt->lt_inclen;
- }
-
- if (lt->lt_mempool) {
- if (lt->lt_buf) {
- lt->lt_buf = (char *)pool_realloc(lt->lt_mempool,
- lt->lt_buf, bufsize);
- }
- else {
- lt->lt_buf = (char *)pool_malloc(lt->lt_mempool, bufsize);
- }
- }
- else {
- if (lt->lt_buf) {
- lt->lt_buf = (char *)REALLOC(lt->lt_buf, bufsize);
- }
- else {
- lt->lt_buf = (char *)MALLOC(bufsize);
- }
- }
- }
-
- if (lt->lt_buf) {
-
- memcpy((void *)(lt->lt_buf + lt->lt_len), (void *)src, nbytes);
- lt->lt_buf[length] = 0;
- lt->lt_len = length;
- lt->lt_buflen = bufsize;
- }
- else {
- /* Error - insufficient memory */
- return LEXERR_MALLOC;
- }
- }
-
- return lt->lt_len;
-}
-
-NSAPI_PUBLIC
-int lex_next_char(LEXStream_t * lst, void * chtab, unsigned long cbits)
-{
- LEXClassTab_t * lct; /* character class table pointer */
- unsigned char * bp; /* bit vector pointer */
- unsigned long bitmask; /* class bit mask temporary */
- int rv; /* return value */
- int i; /* loop index */
-
- lct = (LEXClassTab_t *)chtab;
-
- /* Go get more stream data if none left in the buffer */
- if (lst->lst_len <= 0) {
- rv = (*lst->lst_get)(lst);
- if (rv <= 0) {
- return rv;
- }
- }
-
- /* Get the next character from the buffer */
- rv = *lst->lst_cp;
-
- bitmask = cbits;
- bp = lct->lct_bv + rv * lct->lct_bvbytes;
-
- for (i = 0; i < lct->lct_bvbytes; ++i) {
- if (*bp++ & bitmask) {
- /* Update the buffer pointer and length */
- lst->lst_cp += 1;
- lst->lst_len -= 1;
- break;
- }
- bitmask >>= 8;
- }
-
- return rv;
-}
-
-NSAPI_PUBLIC
-int lex_scan_over(LEXStream_t * lst, void * chtab, unsigned long cbits,
- void * token)
-{
- LEXClassTab_t * lct; /* character class table pointer */
- char * cp; /* current pointer in stream buffer */
- unsigned char * bp; /* bit vector pointer */
- unsigned long bitmask; /* class bit mask temporary */
- int cv = 0; /* current character value */
- int rv = 0; /* return value */
- int slen; /* token segment length */
- int done = 0; /* done indication */
- int i; /* loop index */
-
- lct = (LEXClassTab_t *)chtab;
-
- while (!done) {
-
- /* Go get more stream data if none left in the buffer */
- if (lst->lst_len <= 0) {
- rv = (*lst->lst_get)(lst);
- if (rv <= 0) {
- return rv;
- }
- }
-
- slen = 0;
- cp = lst->lst_cp;
-
- while (slen < lst->lst_len) {
- cv = *cp;
- bitmask = cbits;
- bp = lct->lct_bv + cv * lct->lct_bvbytes;
- for (i = 0; i < lct->lct_bvbytes; ++i) {
- if (*bp++ & bitmask) goto more_token;
- bitmask >>= 8;
- }
-
- done = 1;
- break;
-
- more_token:
- slen += 1;
- cp += 1;
- }
-
- /* If the current segment is not empty, append it to the token */
- if (slen > 0) {
- rv = lex_token_append(token, slen, lst->lst_cp);
- if (rv < 0) break;
-
- /* Update the stream buffer pointer and length */
- lst->lst_cp += slen;
- lst->lst_len -= slen;
- }
- }
-
- return ((rv < 0) ? rv : cv);
-}
-
-/*
- * Description (lex_scan_string)
- *
- * This function parses a quoted string into the specified token.
- * The current character in the LEX stream is taken to be the
- * beginning quote character. The quote character may be included
- * in the string by preceding it with a '\'. Any newline
- * characters to be included in the string must also be preceded
- * by '\'. The string is terminated by another occurrence of the
- * quote character, or an unquoted newline, or EOF.
- *
- * Arguments:
- *
- * lst - pointer to LEX stream structure
- * token - handle for token
- * flags - bit flags (unused - must be zero)
- *
- * Returns:
- *
- * The terminating character is returned, or zero if EOF. The
- * string is returned in the token, without the beginning and
- * ending quote characters. An error is indicated by a negative
- * return value.
- */
-
-NSAPI_PUBLIC
-int lex_scan_string(LEXStream_t * lst, void * token, int flags)
-{
- char * cp; /* current pointer in stream buffer */
- int cv; /* current character value */
- int rv; /* return value */
- int slen; /* token segment length */
- int done = 0; /* done indication */
- int cquote = 0; /* character quote indication */
- int qchar = -1; /* quote character */
-
- while (!done) {
-
- /* Go get more stream data if none left in the buffer */
- if (lst->lst_len <= 0) {
- rv = (*lst->lst_get)(lst);
- if (rv <= 0) {
- return rv;
- }
- }
-
- slen = 0;
- cp = lst->lst_cp;
-
- while (slen < lst->lst_len) {
-
- /* Get the next character */
- cv = *cp;
-
- /* Pick up the quote character if we don't have it yet */
- if (qchar < 0) {
- qchar = cv;
-
- /* Don't include it in the string */
- lst->lst_cp += 1;
- lst->lst_len -= 1;
- cp += 1;
- continue;
- }
-
- /* cquote is 1 if the last character was '\' */
- if (cquote == 0) {
-
- /* Is this a string terminator? */
- if ((cv == qchar) || (cv == '\n')) {
-
- /* Append whatever we have to this point */
- if (slen > 0) goto append_it;
-
- /*
- * If the terminator is the expected quote character,
- * just skip it. If it's anything else, leave it as
- * the current character.
- */
- if (cv == qchar) {
- lst->lst_cp += 1;
- lst->lst_len -= 1;
- }
-
- done = 1;
- goto append_it;
- }
-
- /* Got the character quote character? */
- if (cv == '\\') {
-
- /* Append anything we have so far first */
- if (slen > 0) goto append_it;
-
- /* Then skip the character */
- cquote = 1;
- lst->lst_cp += 1;
- lst->lst_len -= 1;
- cp += 1;
- continue;
- }
- }
- else {
-
- /* Include any character following '\' */
- cquote = 0;
- }
-
- /* Include this character in the string */
- slen += 1;
- cp += 1;
- }
-
- append_it:
-
- /* If the current segment is not empty, append it to the token */
- if (slen > 0) {
- rv = lex_token_append(token, slen, lst->lst_cp);
- if (rv < 0) break;
-
- /* Update the stream buffer pointer and length */
- lst->lst_cp += slen;
- lst->lst_len -= slen;
- }
- }
-
- return ((rv < 0) ? rv : cv);
-}
-
-NSAPI_PUBLIC
-int lex_scan_to(LEXStream_t * lst, void * chtab, unsigned long cbits,
- void * token)
-{
- LEXClassTab_t * lct; /* character class table pointer */
- unsigned char * bp; /* bit vector pointer */
- char * cp; /* current pointer in stream buffer */
- unsigned long bitmask; /* class bit mask temporary */
- int cv = 0; /* current character value */
- int rv = 0; /* return value */
- int slen; /* token segment length */
- int done = 0; /* done indication */
- int i; /* loop index */
-
- lct = (LEXClassTab_t *)chtab;
-
- while (!done) {
-
- /* Go get more stream data if none left in the buffer */
- if (lst->lst_len <= 0) {
- rv = (*lst->lst_get)(lst);
- if (rv <= 0) {
- return rv;
- }
- }
-
- slen = 0;
- cp = lst->lst_cp;
-
- while (slen < lst->lst_len) {
- cv = *cp;
- bitmask = cbits;
- bp = lct->lct_bv + cv * lct->lct_bvbytes;
- for (i = 0; i < lct->lct_bvbytes; ++i) {
- if (*bp++ & bitmask) {
- done = 1;
- goto append_it;
- }
- bitmask >>= 8;
- }
-
- slen += 1;
- cp += 1;
- }
-
- append_it:
-
- /* If the current segment is not empty, append it to the token */
- if (slen > 0) {
- rv = lex_token_append(token, slen, lst->lst_cp);
- if (rv < 0) break;
-
- /* Update the stream buffer pointer and length */
- lst->lst_cp += slen;
- lst->lst_len -= slen;
- }
- }
-
- return ((rv < 0) ? rv : cv);
-}
-
-NSAPI_PUBLIC
-int lex_skip_over(LEXStream_t * lst, void * chtab, unsigned long cbits)
-{
- LEXClassTab_t * lct; /* character class table pointer */
- unsigned char * bp; /* bit vector pointer */
- char * cp; /* current pointer in stream buffer */
- unsigned long bitmask; /* class bit mask temporary */
- int rv = 0; /* return value */
- int slen; /* token segment length */
- int done = 0; /* done indication */
- int i; /* loop index */
-
- lct = (LEXClassTab_t *)chtab;
-
- while (!done) {
-
- /* Go get more stream data if none left in the buffer */
- if (lst->lst_len <= 0) {
- rv = (*lst->lst_get)(lst);
- if (rv <= 0) {
- return rv;
- }
- }
-
- slen = 0;
- cp = lst->lst_cp;
-
- while (slen < lst->lst_len) {
- rv = *cp;
- bitmask = cbits;
- bp = lct->lct_bv + rv * lct->lct_bvbytes;
- for (i = 0; i < lct->lct_bvbytes; ++i) {
- if (*bp++ & bitmask) goto next_ch;
- bitmask >>= 8;
- }
-
- done = 1;
- break;
-
- next_ch:
- slen += 1;
- cp += 1;
- }
-
- if (slen > 0) {
- /* Update the stream buffer pointer and length */
- lst->lst_cp += slen;
- lst->lst_len -= slen;
- }
- }
-
- return rv;
-}
-
-NSAPI_PUBLIC
-int lex_skip_to(LEXStream_t * lst, void * chtab, unsigned long cbits)
-{
- LEXClassTab_t * lct; /* character class table pointer */
- unsigned char * bp; /* bit vector pointer */
- char * cp; /* current pointer in stream buffer */
- unsigned long bitmask; /* class bit mask temporary */
- int rv; /* return value */
- int slen; /* token segment length */
- int done = 0; /* done indication */
- int i; /* loop index */
-
- lct = (LEXClassTab_t *)chtab;
-
- while (!done) {
-
- /* Go get more stream data if none left in the buffer */
- if (lst->lst_len <= 0) {
- rv = (*lst->lst_get)(lst);
- if (rv <= 0) {
- return rv;
- }
- }
-
- slen = 0;
- cp = lst->lst_cp;
-
- while (slen < lst->lst_len) {
- rv = *cp;
- bitmask = cbits;
- bp = lct->lct_bv + rv * lct->lct_bvbytes;
- for (i = 0; i < lct->lct_bvbytes; ++i) {
- if (*bp++ & bitmask) {
- done = 1;
- goto update_it;
- }
- bitmask >>= 8;
- }
- slen += 1;
- cp += 1;
- }
-
- update_it:
- /* Update the stream buffer pointer and length */
- if (slen > 0) {
- lst->lst_cp += slen;
- lst->lst_len -= slen;
- }
- }
-
- return rv;
-}
diff --git a/ltmain.sh b/ltmain.sh
index 0223495a..0223495a 100755..100644
--- a/ltmain.sh
+++ b/ltmain.sh