aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2002-01-18 16:23:55 +0000
committerDaniel Veillard <veillard@src.gnome.org>2002-01-18 16:23:55 +0000
commit572577e094bd436b2124aa0ef44df3d57f97d793 (patch)
tree3ad9ec7da197de132d92c80723bab152e9056667
parentdb5850a23a2bd9d3605d0a1280928428d0bc387f (diff)
downloadandroid_external_libxml2-572577e094bd436b2124aa0ef44df3d57f97d793.tar.gz
android_external_libxml2-572577e094bd436b2124aa0ef44df3d57f97d793.tar.bz2
android_external_libxml2-572577e094bd436b2124aa0ef44df3d57f97d793.zip
removed the last occurences of strdup usage in the code Daniel
* globals.c xmlIO.c xmlcatalog.c: removed the last occurences of strdup usage in the code Daniel
-rw-r--r--ChangeLog5
-rw-r--r--globals.c2
-rw-r--r--xmlIO.c64
-rw-r--r--xmlcatalog.c10
4 files changed, 46 insertions, 35 deletions
diff --git a/ChangeLog b/ChangeLog
index aaba7246..c055fb80 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Jan 18 17:22:50 CET 2002 Daniel Veillard <daniel@veillard.com>
+
+ * globals.c xmlIO.c xmlcatalog.c: removed the last occurences
+ of strdup usage in the code
+
Fri Jan 18 12:47:15 CET 2002 Daniel Veillard <daniel@veillard.com>
* parser.c error.c: Keith Isdale complained rightly that
diff --git a/globals.c b/globals.c
index a66f0e8f..d3e3feb8 100644
--- a/globals.c
+++ b/globals.c
@@ -287,7 +287,7 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
gs->xmlFree = (xmlFreeFunc) free;
gs->xmlMalloc = (xmlMallocFunc) malloc;
gs->xmlRealloc = (xmlReallocFunc) realloc;
- gs->xmlMemStrdup = (xmlStrdupFunc) strdup;
+ gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
#endif
gs->xmlGenericErrorContext = NULL;
gs->xmlGetWarningsDefaultValue = 1;
diff --git a/xmlIO.c b/xmlIO.c
index 1bad043a..016742ca 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -962,56 +962,56 @@ xmlIOHTTPOpen (const char *filename) {
*/
void *
-xmlIOHTTPOpenW( const char * post_uri, int compression ) {
+xmlIOHTTPOpenW(const char *post_uri, int compression)
+{
- xmlIOHTTPWriteCtxtPtr ctxt = NULL;
+ xmlIOHTTPWriteCtxtPtr ctxt = NULL;
- if ( post_uri == NULL )
- return ( NULL );
+ if (post_uri == NULL)
+ return (NULL);
- ctxt = xmlMalloc( sizeof( xmlIOHTTPWriteCtxt ) );
- if ( ctxt == NULL ) {
- xmlGenericError( xmlGenericErrorContext,
- "xmlIOHTTPOpenW: Failed to create output HTTP context.\n" );
- return ( NULL );
+ ctxt = xmlMalloc(sizeof(xmlIOHTTPWriteCtxt));
+ if (ctxt == NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlIOHTTPOpenW: Failed to create output HTTP context.\n");
+ return (NULL);
}
- (void)memset( ctxt, 0, sizeof( xmlIOHTTPWriteCtxt ) );
+ (void) memset(ctxt, 0, sizeof(xmlIOHTTPWriteCtxt));
- ctxt->uri = strdup( post_uri );
- if ( ctxt->uri == NULL ) {
- xmlGenericError( xmlGenericErrorContext,
- "xmlIOHTTPOpenW: Failed to duplicate destination URI.\n" );
- xmlFreeHTTPWriteCtxt( ctxt );
- return ( NULL );
+ ctxt->uri = (char *) xmlStrdup((const xmlChar *)post_uri);
+ if (ctxt->uri == NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlIOHTTPOpenW: Failed to duplicate destination URI.\n");
+ xmlFreeHTTPWriteCtxt(ctxt);
+ return (NULL);
}
/*
- ** Since the document length is required for an HTTP post,
- ** need to put the document into a buffer. A memory buffer
- ** is being used to avoid pushing the data to disk and back.
- */
+ * ** Since the document length is required for an HTTP post,
+ * ** need to put the document into a buffer. A memory buffer
+ * ** is being used to avoid pushing the data to disk and back.
+ */
#ifdef HAVE_ZLIB_H
- if ( ( compression > 0 ) && ( compression <= 9 ) ) {
-
- ctxt->compression = compression;
- ctxt->doc_buff = xmlCreateZMemBuff( compression );
- }
- else
+ if ((compression > 0) && (compression <= 9)) {
+
+ ctxt->compression = compression;
+ ctxt->doc_buff = xmlCreateZMemBuff(compression);
+ } else
#endif
{
- /* Any character conversions should have been done before this */
+ /* Any character conversions should have been done before this */
- ctxt->doc_buff = xmlAllocOutputBuffer( NULL );
+ ctxt->doc_buff = xmlAllocOutputBuffer(NULL);
}
- if ( ctxt->doc_buff == NULL ) {
- xmlFreeHTTPWriteCtxt( ctxt );
- ctxt = NULL;
+ if (ctxt->doc_buff == NULL) {
+ xmlFreeHTTPWriteCtxt(ctxt);
+ ctxt = NULL;
}
- return ( ctxt );
+ return (ctxt);
}
/**
diff --git a/xmlcatalog.c b/xmlcatalog.c
index 3f153698..e0828faa 100644
--- a/xmlcatalog.c
+++ b/xmlcatalog.c
@@ -72,17 +72,23 @@ xmlShellReadline(const char *prompt) {
return (line_read);
#else
char line_read[501];
+ char *ret;
+ int len;
if (prompt != NULL)
fprintf(stdout, "%s", prompt);
if (!fgets(line_read, 500, stdin))
return(NULL);
line_read[500] = 0;
- return(strdup(line_read));
+ len = strlen(line_read);
+ ret = (char *) malloc(len + 1);
+ if (ret != NULL) {
+ memcpy (ret, line_read, len + 1);
+ }
+ return(ret);
#endif
}
-
static void usershell(void) {
char *cmdline = NULL, *cur;
int nbargs;