浏览代码

Bug 610177 - fix coverity Defect Type: Uninitialized variables issues

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
Rich Megginson 15 年之前
父节点
当前提交
4a103859b7

+ 0 - 1
Makefile.am

@@ -533,7 +533,6 @@ libns_dshttpd_la_SOURCES = lib/libaccess/access_plhash.cpp \
 	lib/base/ereport.cpp \
 	lib/base/ereport.cpp \
 	lib/base/file.cpp \
 	lib/base/file.cpp \
 	lib/base/fsmutex.cpp \
 	lib/base/fsmutex.cpp \
-	lib/base/lexer.cpp \
 	lib/base/net.cpp \
 	lib/base/net.cpp \
 	lib/base/nscperror.c \
 	lib/base/nscperror.c \
 	lib/base/plist.cpp \
 	lib/base/plist.cpp \

+ 0 - 14
Makefile.in

@@ -335,7 +335,6 @@ am_libns_dshttpd_la_OBJECTS =  \
 	lib/base/libns_dshttpd_la-ereport.lo \
 	lib/base/libns_dshttpd_la-ereport.lo \
 	lib/base/libns_dshttpd_la-file.lo \
 	lib/base/libns_dshttpd_la-file.lo \
 	lib/base/libns_dshttpd_la-fsmutex.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-net.lo \
 	lib/base/libns_dshttpd_la-nscperror.lo \
 	lib/base/libns_dshttpd_la-nscperror.lo \
 	lib/base/libns_dshttpd_la-plist.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/ereport.cpp \
 	lib/base/file.cpp \
 	lib/base/file.cpp \
 	lib/base/fsmutex.cpp \
 	lib/base/fsmutex.cpp \
-	lib/base/lexer.cpp \
 	lib/base/net.cpp \
 	lib/base/net.cpp \
 	lib/base/nscperror.c \
 	lib/base/nscperror.c \
 	lib/base/plist.cpp \
 	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/$(DEPDIR)/$(am__dirstamp)
 lib/base/libns_dshttpd_la-fsmutex.lo: lib/base/$(am__dirstamp) \
 lib/base/libns_dshttpd_la-fsmutex.lo: lib/base/$(am__dirstamp) \
 	lib/base/$(DEPDIR)/$(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/libns_dshttpd_la-net.lo: lib/base/$(am__dirstamp) \
 	lib/base/$(DEPDIR)/$(am__dirstamp)
 	lib/base/$(DEPDIR)/$(am__dirstamp)
 lib/base/libns_dshttpd_la-nscperror.lo: lib/base/$(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-file.lo
 	-rm -f lib/base/libns_dshttpd_la-fsmutex.$(OBJEXT)
 	-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-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.$(OBJEXT)
 	-rm -f lib/base/libns_dshttpd_la-net.lo
 	-rm -f lib/base/libns_dshttpd_la-net.lo
 	-rm -f lib/base/libns_dshttpd_la-nscperror.$(OBJEXT)
 	-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-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-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-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-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-nscperror.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@lib/base/$(DEPDIR)/libns_dshttpd_la-plist.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@
 @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
 @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
 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@	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
 @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

+ 0 - 126
include/base/lexer.h

@@ -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 */

+ 0 - 2
include/libaccess/aclstruct.h

@@ -52,7 +52,6 @@
 
 
 #include "base/systems.h"
 #include "base/systems.h"
 #include "base/file.h"
 #include "base/file.h"
-#include "base/lexer.h"
 #include "nsauth.h"		/* authentication types */
 #include "nsauth.h"		/* authentication types */
 #include "symbols.h"		/* typed symbol support */
 #include "symbols.h"		/* typed symbol support */
 #include "ipfstruct.h"		/* IP address filter structures */
 #include "ipfstruct.h"		/* IP address filter structures */
@@ -288,7 +287,6 @@ typedef struct ACLFile_s ACLFile_t;
 struct ACLFile_s {
 struct ACLFile_s {
     ACLFile_t * acf_next;		/* list link */
     ACLFile_t * acf_next;		/* list link */
     char * acf_filename;		/* pointer to filename string */
     char * acf_filename;		/* pointer to filename string */
-    LEXStream_t * acf_lst;		/* LEX stream handle */
     SYS_FILE acf_fd;			/* file descriptor */
     SYS_FILE acf_fd;			/* file descriptor */
     int acf_flags;			/* bit flags (unused) */
     int acf_flags;			/* bit flags (unused) */
     int acf_lineno;			/* current line number */
     int acf_lineno;			/* current line number */

+ 1 - 1
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) {
 	    if (errno == ERANGE) {
 		rc = LDAP_CONSTRAINT_VIOLATION;
 		rc = LDAP_CONSTRAINT_VIOLATION;
 	    } else {
 	    } else {
-		int result;
+		int result = 0;
 		/* The Microsoft Windows AD bitwise operators do not work exactly
 		/* The Microsoft Windows AD bitwise operators do not work exactly
 		   as the plain old C bitwise operators work.  For the AND case
 		   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
 		   the matching rule is true only if all bits from the given value

+ 3 - 3
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)
 static int cos_cache_add_dn_defs(char *dn, cosDefinitions **pDefs, int *vattr_cacheable)
 {
 {
 	Slapi_PBlock *pDnSearch = 0;
 	Slapi_PBlock *pDnSearch = 0;
-	struct dn_defs_info info;
+	struct dn_defs_info info = {NULL, 0, 0};
     pDnSearch = slapi_pblock_new();
     pDnSearch = slapi_pblock_new();
 	if (pDnSearch) {
 	if (pDnSearch) {
 		info.ret=-1; /* assume no good defs */
 		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;
 	void *plugin_id;
 	int scope;
 	int scope;
-	struct tmpl_info	info;
+	struct tmpl_info	info = {NULL, 0, 0};
 	Slapi_PBlock *pDnSearch = 0;
 	Slapi_PBlock *pDnSearch = 0;
 
 
 	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_add_dn_tmpls\n",0,0,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 cos_cache_addref(cos_cache *ptheCache)
 {
 {
-	int ret;
+	int ret = 0;
 	cosCache *pCache = (cosCache*)ptheCache;
 	cosCache *pCache = (cosCache*)ptheCache;
 	
 	
 	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_addref\n",0,0,0);
 	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_addref\n",0,0,0);

+ 1 - 1
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,
 	int deleteoldrdn, LDAPControl *update_control,
 	const char *extop_oid, struct berval *extop_payload, int *message_id)
 	const char *extop_oid, struct berval *extop_payload, int *message_id)
 {
 {
-	int rc;
+	int rc = -1;
 	ConnResult return_value = CONN_OPERATION_FAILED;
 	ConnResult return_value = CONN_OPERATION_FAILED;
 	LDAPControl *server_controls[3];
 	LDAPControl *server_controls[3];
 	/* LDAPControl **loc_returned_controls; */
 	/* LDAPControl **loc_returned_controls; */

+ 2 - 2
ldap/servers/plugins/replication/repl5_inc_protocol.c

@@ -1384,7 +1384,7 @@ reset_events (Private_Repl_Protocol *prp)
 ConnResult
 ConnResult
 replay_update(Private_Repl_Protocol *prp, slapi_operation_parameters *op, int *message_id)
 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;
 	LDAPControl *update_control;
 	char *parentuniqueid;
 	char *parentuniqueid;
 	LDAPMod **modrdn_mods = NULL;
 	LDAPMod **modrdn_mods = NULL;
@@ -2202,7 +2202,7 @@ examine_update_vector(Private_Repl_Protocol *prp, RUV *remote_ruv)
 static PRBool
 static PRBool
 ignore_error_and_keep_going(int error)
 ignore_error_and_keep_going(int error)
 {
 {
-	int return_value;
+	int return_value = PR_FALSE;
 
 
 	switch (error)
 	switch (error)
 	{
 	{

+ 2 - 2
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,
 	const char *extop_oid, struct berval *extop_payload, char **retoidp,
 	struct berval **retdatap, LDAPControl ***returned_controls)
 	struct berval **retdatap, LDAPControl ***returned_controls)
 {
 {
-	int rc = LDAP_SUCCESS;
+	int rc = -1;
 	ConnResult return_value;
 	ConnResult return_value;
 	LDAPControl **loc_returned_controls;
 	LDAPControl **loc_returned_controls;
 	const char *op_string = NULL;
 	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))
 	if (windows_conn_connected(conn))
 	{
 	{
-		int msgid;
+		int msgid = -2; /* should match no messages */
 
 
 		conn->last_operation = optype;
 		conn->last_operation = optype;
 		switch (optype)
 		switch (optype)

+ 1 - 1
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
 static int
 is_single_valued_attr(const char *type)
 is_single_valued_attr(const char *type)
 {
 {
-	int found;
+	int found = 0;
 	size_t offset = 0;
 	size_t offset = 0;
 	char *this_attr = NULL;
 	char *this_attr = NULL;
 
 

+ 1 - 1
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)
 static int views_cache_add_dn_views(char *dn, viewEntry **pViews)
 {
 {
 	Slapi_PBlock *pDnSearch = 0;
 	Slapi_PBlock *pDnSearch = 0;
-	struct dn_views_info info;
+	struct dn_views_info info = {NULL, -1};
     pDnSearch = slapi_pblock_new();
     pDnSearch = slapi_pblock_new();
 	if (pDnSearch) {
 	if (pDnSearch) {
 		info.ret=-1;
 		info.ret=-1;

+ 1 - 1
ldap/servers/slapd/back-ldbm/idl.c

@@ -1272,7 +1272,7 @@ void idl_insert(IDList **idl, ID id)
 static int
 static int
 idl_insert_maxids( IDList **idl, ID id, int maxids )
 idl_insert_maxids( IDList **idl, ID id, int maxids )
 {
 {
-	ID	i, j;
+	ID	i = 0, j = 0;
 	NIDS  nids;
 	NIDS  nids;
 
 
 	if ( ALLIDS( *idl ) ) {
 	if ( ALLIDS( *idl ) ) {

+ 1 - 1
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 )
 			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 );
 				slapi_pblock_set( &pb, SLAPI_PLUGIN, backends[i]->be_database );
                 if(backends[i]->be_state != BE_STATE_DELETED && 
                 if(backends[i]->be_state != BE_STATE_DELETED && 
 				   backends[i]->be_unbind!=NULL)
 				   backends[i]->be_unbind!=NULL)

+ 1 - 1
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;
     Slapi_DN *subtree = NULL;
     const char *tmp_ndn;
     const char *tmp_ndn;
     int be_list_count = 0;
     int be_list_count = 0;
-    int be_list_size;
+    int be_list_size = 0;
     backend **be_list = NULL;
     backend **be_list = NULL;
     char **be_names = NULL;
     char **be_names = NULL;
     int * be_states = NULL;
     int * be_states = NULL;

+ 1 - 1
ldap/servers/slapd/tools/ldclt/ldapfct.c

@@ -2238,7 +2238,7 @@ getPending (
 {
 {
   LDAPMessage	*res;		/* LDAP async results */
   LDAPMessage	*res;		/* LDAP async results */
   int		 ret;		/* Return values */
   int		 ret;		/* Return values */
-  int		 expected;	/* Expect this type */
+  int		 expected = 0;	/* Expect this type */
   char		*verb;		/* LDAP verb expected */
   char		*verb;		/* LDAP verb expected */
   int		 type;		/* Message type */
   int		 type;		/* Message type */
   int		 errcodep;	/* Async error code */
   int		 errcodep;	/* Async error code */

+ 0 - 1015
lib/base/lexer.cpp

@@ -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;
-}

+ 0 - 0
ltmain.sh