diff --git a/src/zmapApp/zmapAppwindow.c b/src/zmapApp/zmapAppwindow.c index 46d3a94e15e07514dab557c22b7349f93dab4ebf..6e6a11cce41894297156fc37f2d8402cc75d7bd2 100755 --- a/src/zmapApp/zmapAppwindow.c +++ b/src/zmapApp/zmapAppwindow.c @@ -26,9 +26,9 @@ * Description: * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: - * Last edited: May 7 10:08 2004 (edgrif) + * Last edited: Jul 16 09:36 2004 (edgrif) * Created: Thu Jul 24 14:36:27 2003 (edgrif) - * CVS info: $Id: zmapAppwindow.c,v 1.8 2004-05-07 09:19:33 edgrif Exp $ + * CVS info: $Id: zmapAppwindow.c,v 1.9 2004-07-16 08:46:14 edgrif Exp $ *------------------------------------------------------------------- */ @@ -171,7 +171,7 @@ static ZMapAppContext createAppContext(void) { ZMapAppContext app_context ; - app_context = g_new(ZMapAppContextStruct, sizeof(ZMapAppContextStruct)) ; + app_context = g_new0(ZMapAppContextStruct, sizeof(ZMapAppContextStruct)) ; app_context->app_widg = app_context->sequence_widg = app_context->clist_widg = NULL ; diff --git a/src/zmapConfig/zmapConfig.c b/src/zmapConfig/zmapConfig.c index 0ec198a3204f9423e09b3fad8399411120f1f8cc..6e1b86519a95e45ea321947f2802f2460635c788 100755 --- a/src/zmapConfig/zmapConfig.c +++ b/src/zmapConfig/zmapConfig.c @@ -25,9 +25,9 @@ * Description: * Exported functions: See zmapConfig.h * HISTORY: - * Last edited: Jun 23 12:52 2004 (edgrif) + * Last edited: Jul 16 09:37 2004 (edgrif) * Created: Thu Jul 24 16:06:44 2003 (edgrif) - * CVS info: $Id: zmapConfig.c,v 1.9 2004-06-25 13:36:49 edgrif Exp $ + * CVS info: $Id: zmapConfig.c,v 1.10 2004-07-16 08:46:16 edgrif Exp $ *------------------------------------------------------------------- */ @@ -404,7 +404,7 @@ static ZMapConfig createConfig(void) { ZMapConfig config ; - config = g_new(ZMapConfigStruct, sizeof(ZMapConfigStruct)) ; + config = g_new0(ZMapConfigStruct, sizeof(ZMapConfigStruct)) ; config->config_dir = config->config_file = NULL ; diff --git a/src/zmapConfig/zmapConfigGet.c b/src/zmapConfig/zmapConfigGet.c index 42b1ee4cfd5d4923102ce06916e8351ff0a7c13f..44cf4f2711dac8f1b3fc8a3f75a37787079431dc 100755 --- a/src/zmapConfig/zmapConfigGet.c +++ b/src/zmapConfig/zmapConfigGet.c @@ -25,9 +25,9 @@ * Description: * Exported functions: See zmapConfig_P.h * HISTORY: - * Last edited: May 7 10:39 2004 (edgrif) + * Last edited: Jul 16 09:37 2004 (edgrif) * Created: Mon Apr 5 11:09:52 2004 (edgrif) - * CVS info: $Id: zmapConfigGet.c,v 1.3 2004-05-07 09:43:29 edgrif Exp $ + * CVS info: $Id: zmapConfigGet.c,v 1.4 2004-07-16 08:46:17 edgrif Exp $ *------------------------------------------------------------------- */ @@ -53,7 +53,7 @@ gboolean zmapGetConfigStanzas(ZMapConfig config, GList *config_stanza_list ; ZMapConfigStanzaSet stanzas ; - stanzas = g_new(ZMapConfigStanzaSetStruct, 1) ; + stanzas = g_new0(ZMapConfigStanzaSetStruct, 1) ; stanzas->name = NULL ; stanzas->stanzas = NULL ; diff --git a/src/zmapConfig/zmapConfigUtils.c b/src/zmapConfig/zmapConfigUtils.c index dcf2024e5e80465ab6d49bc098268a60139fe650..d81f35d0a789bf74046075665de0c44dc2639b07 100755 --- a/src/zmapConfig/zmapConfigUtils.c +++ b/src/zmapConfig/zmapConfigUtils.c @@ -25,9 +25,9 @@ * Description: * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: - * Last edited: Apr 6 16:58 2004 (edgrif) + * Last edited: Jul 16 09:37 2004 (edgrif) * Created: Tue Apr 6 12:30:05 2004 (edgrif) - * CVS info: $Id: zmapConfigUtils.c,v 1.1 2004-04-08 16:40:36 edgrif Exp $ + * CVS info: $Id: zmapConfigUtils.c,v 1.2 2004-07-16 08:46:18 edgrif Exp $ *------------------------------------------------------------------- */ @@ -44,7 +44,7 @@ ZMapConfigStanza zmapConfigCreateStanza(char *stanza_name) { ZMapConfigStanza stanza ; - stanza = g_new(ZMapConfigStanzaStruct, 1) ; + stanza = g_new0(ZMapConfigStanzaStruct, 1) ; stanza->name = g_strdup(stanza_name) ; stanza->elements = NULL ; @@ -112,7 +112,7 @@ ZMapConfigStanzaElement zmapConfigCreateElement(char *name, ZMapConfigElementTyp { ZMapConfigStanzaElement element ; - element = g_new(ZMapConfigStanzaElementStruct, 1) ; + element = g_new0(ZMapConfigStanzaElementStruct, 1) ; element->name = g_strdup(name) ; element->type = type ; diff --git a/src/zmapControl/zmapControl.c b/src/zmapControl/zmapControl.c index ec872be46abf98d58b78e93cd6c88f36be288b4b..b459653a75aa756ee915b28f8db9881c0f06f78e 100755 --- a/src/zmapControl/zmapControl.c +++ b/src/zmapControl/zmapControl.c @@ -26,9 +26,9 @@ * the window code and the threaded server code. * Exported functions: See ZMap.h * HISTORY: - * Last edited: Jul 15 17:29 2004 (rnc) + * Last edited: Jul 16 09:24 2004 (edgrif) * Created: Thu Jul 24 16:06:44 2003 (edgrif) - * CVS info: $Id: zmapControl.c,v 1.17 2004-07-15 16:29:25 rnc Exp $ + * CVS info: $Id: zmapControl.c,v 1.18 2004-07-16 08:46:15 edgrif Exp $ *------------------------------------------------------------------- */ @@ -133,8 +133,8 @@ ZMap zMapCreate(void *app_data) /* Hack to read methods from a file in $HOME/.ZMap for now..... */ - // temporarily commented out during code merge - // zMapAssert(zmap->types = getTypesFromFile()) ; + zmap->types = getTypesFromFile() ; + zMapAssert(zmap->types) ; /* Make the main/toplevel window for the ZMap. */ diff --git a/src/zmapGFF/zmapGFF2parser.c b/src/zmapGFF/zmapGFF2parser.c index 3c7b0630b962601116aa293bff1dc0e23999711b..43c285736715aea45b957e49336fe27e15c06778 100755 --- a/src/zmapGFF/zmapGFF2parser.c +++ b/src/zmapGFF/zmapGFF2parser.c @@ -26,9 +26,9 @@ * * Exported functions: See ZMap/zmapGFF.h * HISTORY: - * Last edited: Jul 14 14:04 2004 (edgrif) + * Last edited: Jul 16 09:36 2004 (edgrif) * Created: Fri May 28 14:25:12 2004 (edgrif) - * CVS info: $Id: zmapGFF2parser.c,v 1.8 2004-07-14 13:07:42 edgrif Exp $ + * CVS info: $Id: zmapGFF2parser.c,v 1.9 2004-07-16 08:46:13 edgrif Exp $ *------------------------------------------------------------------- */ @@ -76,7 +76,7 @@ ZMapGFFParser zMapGFFCreateParser(gboolean parse_only) { ZMapGFFParser parser ; - parser = g_new(ZMapGFFParserStruct, 1) ; + parser = g_new0(ZMapGFFParserStruct, 1) ; parser->state = ZMAPGFF_PARSE_HEADER ; parser->error = NULL ; @@ -617,7 +617,7 @@ static gboolean makeNewFeature(ZMapGFFParser parser, char *sequence, char *sourc /* If we don't have this feature_set yet, then make one. */ if (!feature_set) { - feature_set = g_new(ZMapGFFParserFeatureSetStruct, 1) ; + feature_set = g_new0(ZMapGFFParserFeatureSetStruct, 1) ; g_datalist_set_data_full(&(parser->feature_sets), source, feature_set, destroyFeatureArray) ; @@ -734,7 +734,7 @@ static gboolean makeNewFeature(ZMapGFFParser parser, char *sequence, char *sourc /* If we don't have this feature_set yet, then make one. */ if (!feature_set) { - feature_set = g_new(ZMapGFFParserFeatureSetStruct, 1) ; + feature_set = g_new0(ZMapGFFParserFeatureSetStruct, 1) ; g_datalist_set_data_full(&(parser->feature_sets), source, feature_set, destroyFeatureArray) ; @@ -1257,7 +1257,7 @@ static void getFeatureArray(GQuark key_id, gpointer data, gpointer user_data) GData **features = (GData **)user_data ; ZMapFeatureSetStruct *new_features ; - new_features = g_new(ZMapFeatureSetStruct, 1) ; + new_features = g_new0(ZMapFeatureSetStruct, 1) ; new_features->source = g_strdup(feature_set->source) ; new_features->features = feature_set->features ; diff --git a/src/zmapManager/zmapManager.c b/src/zmapManager/zmapManager.c index 97ff7e66c18328deaeb116b566099eea45b21b8d..48c2fd4bcbb528455784129ed3a8f8160d6bd0f2 100755 --- a/src/zmapManager/zmapManager.c +++ b/src/zmapManager/zmapManager.c @@ -25,9 +25,9 @@ * Description: * Exported functions: See zmapManager.h * HISTORY: - * Last edited: Jul 13 16:02 2004 (edgrif) + * Last edited: Jul 16 09:38 2004 (edgrif) * Created: Thu Jul 24 16:06:44 2003 (edgrif) - * CVS info: $Id: zmapManager.c,v 1.10 2004-07-14 09:09:13 edgrif Exp $ + * CVS info: $Id: zmapManager.c,v 1.11 2004-07-16 08:46:20 edgrif Exp $ *------------------------------------------------------------------- */ @@ -49,7 +49,7 @@ ZMapManager zMapManagerCreate(zmapAppCallbackFunc zmap_deleted_func, void *gui_d { ZMapManager manager ; - manager = g_new(ZMapManagerStruct, sizeof(ZMapManagerStruct)) ; + manager = g_new0(ZMapManagerStruct, sizeof(ZMapManagerStruct)) ; manager->zmap_list = NULL ; diff --git a/src/zmapNoThreads/zmapConnNoThr.c b/src/zmapNoThreads/zmapConnNoThr.c index 94a89dec3f4991f648508f73c573a36145d01abb..77d7fbf2f1af6fd3b10c7d8427edf05fe2e78d59 100755 --- a/src/zmapNoThreads/zmapConnNoThr.c +++ b/src/zmapNoThreads/zmapConnNoThr.c @@ -25,9 +25,9 @@ * Description: * Exported functions: See zmapConn.h * HISTORY: - * Last edited: Apr 7 10:28 2004 (edgrif) + * Last edited: Jul 16 09:37 2004 (edgrif) * Created: Thu Jul 24 14:37:18 2003 (edgrif) - * CVS info: $Id: zmapConnNoThr.c,v 1.3 2004-04-08 16:47:05 edgrif Exp $ + * CVS info: $Id: zmapConnNoThr.c,v 1.4 2004-07-16 08:46:19 edgrif Exp $ *------------------------------------------------------------------- */ @@ -47,7 +47,7 @@ ZMapConnection zMapConnCreate(char *machine, int port, char *protocol, char *seq ZMapConnection connection ; int status ; - connection = g_new(ZMapConnectionStruct, sizeof(ZMapConnectionStruct)) ; + connection = g_new0(ZMapConnectionStruct, sizeof(ZMapConnectionStruct)) ; connection->machine = g_strdup(machine) ; connection->port = port ; diff --git a/src/zmapServer/das/dasServer.c b/src/zmapServer/das/dasServer.c index d0f6aa041b79da872b4c521d72ed12348d2fddd4..ed3a143a5c4ae06febae0ecccb479c63ef55990a 100755 --- a/src/zmapServer/das/dasServer.c +++ b/src/zmapServer/das/dasServer.c @@ -27,9 +27,9 @@ * * Exported functions: See ZMap/zmapServerPrototype.h * HISTORY: - * Last edited: Jun 29 13:52 2004 (edgrif) + * Last edited: Jul 16 09:38 2004 (edgrif) * Created: Wed Aug 6 15:46:38 2003 (edgrif) - * CVS info: $Id: dasServer.c,v 1.3 2004-06-29 12:52:48 edgrif Exp $ + * CVS info: $Id: dasServer.c,v 1.4 2004-07-16 08:46:22 edgrif Exp $ *------------------------------------------------------------------- */ @@ -38,8 +38,6 @@ #include <ZMap/zmapServerPrototype.h> #include <dasServer_P.h> -static size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data) ; - static gboolean globalInit(void) ; static gboolean createConnection(void **server_out, @@ -48,15 +46,20 @@ static gboolean createConnection(void **server_out, static gboolean openConnection(void *server) ; static gboolean request(void *server, ZMapServerRequestType request, char *sequence, ZMapFeatureContext *feature_context) ; +static size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data) ; static char *lastErrorMsg(void *server) ; static gboolean closeConnection(void *server) ; static gboolean destroyConnection(void *server) ; -/* Compulsory routine, without this we can't do anything....returns a list of functions - * that can be used to contact a DAS server. The functions are only visible through - * this struct. */ +/* Although most of these "external" routines are static they are properly part of our + * external interface and hence are in the external section of this file. */ + + +/* Compulsory routine, the caller must call this to get a list of our interface + * functions, without this they can't do anything. The functions are only + * visible through this struct. */ void dasGetServerFuncs(ZMapServerFuncs das_funcs) { das_funcs->global_init = globalInit ; @@ -77,13 +80,6 @@ void dasGetServerFuncs(ZMapServerFuncs das_funcs) * the rest of the url = request */ - - -/* - * --------------------- Internal routines. --------------------- - */ - - /* For stuff that just needs to be done once at the beginning..... */ static gboolean globalInit(void) { @@ -113,7 +109,7 @@ static gboolean createConnection(void **server_out, gboolean result = TRUE ; DasServer server ; - server = (DasServer)g_new(DasServerStruct, 1) ; + server = (DasServer)g_new0(DasServerStruct, 1) ; server->host = g_strdup(host) ; server->port = port ; @@ -124,11 +120,15 @@ static gboolean createConnection(void **server_out, #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */ server->chunks = 0 ; - server->parser = saxCreateParser() ; + + /* hack for now, need to parse in a proper struct here that can be interpreted and filled in + * properly..... */ + server->parser = saxCreateParser(&(server->data)) ; + server->last_errmsg = NULL ; server->curl_error = CURLE_OK ; server->curl_errmsg = (char *)g_malloc0(CURL_ERROR_SIZE * 2) ; /* Big margin for safety. */ - + server->data = NULL ; /* init the curl session */ if (!(server->curl_handle = curl_easy_init())) @@ -189,10 +189,17 @@ static gboolean request(void *server_in, ZMapServerRequestType request, DasServer server = (DasServer)server_in ; /* specify URL to get */ + /* FAKED FOR NOW......... */ + { + char *url = "http://dev.acedb.org/das/wormbase/1/type" ; + + curl_easy_setopt(server->curl_handle, CURLOPT_URL, url) ; + } + + + /* WE COULD CREATE A FRESH PARSER AT WITH EACH CALL AT THIS POINT, WOULD BE SIMPLER + * PROBABLY..... */ -#ifdef ED_G_NEVER_INCLUDE_THIS_CODE - curl_easy_setopt(server->curl_handle, CURLOPT_URL, request) ; -#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */ /* Hacked for now, normally we will use the request passed in..... */ if (result && @@ -269,6 +276,12 @@ static gboolean destroyConnection(void *server_in) +/* + * --------------------- Internal routines. --------------------- + */ + + + /* Gets called by libcurl code every time libcurl has gathered some data from the http * server, this routine then sends the data to the expat xml parser. */ static size_t WriteMemoryCallback(void *xml, size_t size, size_t nmemb, void *app_data) diff --git a/src/zmapServer/das/saxparse.c b/src/zmapServer/das/saxparse.c index 64ccf3c65c14db77aac11f98ee7e93bfe9e70323..569956116daf6b03733d0c20cdb111c0f88a2fe0 100755 --- a/src/zmapServer/das/saxparse.c +++ b/src/zmapServer/das/saxparse.c @@ -27,15 +27,16 @@ * * Exported functions: See saxparse.h * HISTORY: - * Last edited: Mar 18 16:16 2004 (edgrif) + * Last edited: Jul 16 09:39 2004 (edgrif) * Created: Thu Mar 18 15:45:59 2004 (edgrif) - * CVS info: $Id: saxparse.c,v 1.1 2004-03-22 13:45:19 edgrif Exp $ + * CVS info: $Id: saxparse.c,v 1.2 2004-07-16 08:46:23 edgrif Exp $ *------------------------------------------------------------------- */ #include <stdio.h> #include <expat.h> #include <glib.h> +#include <ZMap/zmapUtils.h> #include <saxparse_P.h> @@ -45,30 +46,25 @@ static void charhndl(void *userData, const XML_Char *s, int len) ; static void tagFree(gpointer data, gpointer user_data) ; -SaxParser saxCreateParser(void) + +SaxParser saxCreateParser(void *user_data) { SaxParser parser ; - parser = (SaxParser)g_new(SaxParserStruct, 1) ; + parser = (SaxParser)g_new0(SaxParserStruct, 1) ; + + parser->debug = TRUE ; - parser->p = XML_ParserCreate(NULL) ; - if (!parser->p) + if (!(parser->p = XML_ParserCreate(NULL))) { - fprintf(stderr, "Couldn't allocate memory for parser\n"); - exit(-1); + zMapLogFatal("%s", "XML_ParserCreate() failed.") ; } - XML_SetElementHandler(parser->p, start_tag, end_tag); - - XML_SetCharacterDataHandler(parser->p, charhndl) ; - - XML_SetUserData(parser->p, (void *)parser) ; - parser->Depth = 0 ; parser->tag_stack = g_queue_new() ; - parser->content = g_string_sized_new(1000) ; /* wild guess at size... */ + parser->content = g_string_sized_new(20000) ; /* wild guess at size... */ parser->last_errmsg = NULL ; @@ -76,6 +72,7 @@ SaxParser saxCreateParser(void) } + gboolean saxParseData(SaxParser parser, void *data, int size) { gboolean result = TRUE ; @@ -86,14 +83,32 @@ gboolean saxParseData(SaxParser parser, void *data, int size) else final = 1 ; - if (!XML_Parse(parser->p, data, size, final)) + /* try resetting parser..... */ + if (XML_ParserReset(parser->p, NULL) != XML_TRUE) { - parser->last_errmsg = g_strdup_printf("saxparse - Parse error at line %d:\n%s\n", - XML_GetCurrentLineNumber(parser->p), - XML_ErrorString(XML_GetErrorCode(parser->p))) ; - result = FALSE ; + zMapLogFatal("%s", "XML_ParserReset() call failed.") ; + } + else + { + /* When the parser is reset it loses just about everything so reset the lot. */ + XML_SetElementHandler(parser->p, start_tag, end_tag); + XML_SetCharacterDataHandler(parser->p, charhndl) ; + XML_SetUserData(parser->p, (void *)parser) ; + + + if (!XML_Parse(parser->p, data, size, final)) + { + if (parser->last_errmsg) + g_free(parser->last_errmsg) ; + + parser->last_errmsg = g_strdup_printf("saxparse - Parse error (line %d): %s\n", + XML_GetCurrentLineNumber(parser->p), + XML_ErrorString(XML_GetErrorCode(parser->p))) ; + result = FALSE ; + } } + return result ; } @@ -105,18 +120,25 @@ void saxDestroyParser(SaxParser parser) /* Deallocate tag data and then free the queue. */ if (!g_queue_is_empty(parser->tag_stack)) { - #ifdef ED_G_NEVER_INCLUDE_THIS_CODE - /* Need newer version of glib...hopefully to be installed on Alphas etc.... */ + /* alpha version of gtk does not have this....so do it by steam...sigh.... */ g_queue_foreach(parser->tag_stack, tagFree, parser) ; #endif /* ED_G_NEVER_INCLUDE_THIS_CODE */ + gpointer dummy ; + + while ((dummy = g_queue_pop_head(parser->tag_stack))) + { + g_free(dummy) ; + } + } g_queue_free(parser->tag_stack) ; g_string_free(parser->content, TRUE) ; /* TRUE => free string data as well. */ - g_free(parser->last_errmsg) ; + if (parser->last_errmsg) + g_free(parser->last_errmsg) ; g_free(parser) ; @@ -124,12 +146,9 @@ void saxDestroyParser(SaxParser parser) } - - - -static void tagFree(gpointer data, gpointer user_data) +static void tagFree(gpointer data, gpointer user_data_unused) { - SaxParser parser = (SaxParser)user_data ; + SaxParser parser = (SaxParser)user_data_unused ; g_free(data) ; @@ -146,24 +165,36 @@ static void tagFree(gpointer data, gpointer user_data) static void start_tag(void *userData, const char *el, const char **attr) { SaxParser parser = (SaxParser)userData ; + SaxTag current_tag ; int i; + - for (i = 0; i < parser->Depth; i++) - printf(" "); + if (parser->debug) + { + for (i = 0; i < parser->Depth; i++) + printf(" "); + + printf("<%s>", el) ; - printf("<%s>", el) ; + if (attr[0]) + { + printf(" - ") ; - if (attr[i]) - printf(" - ") ; + for (i = 0; attr[i]; i += 2) + { + printf(" %s='%s'", attr[i], attr[i + 1]); + } + } - for (i = 0; attr[i]; i += 2) - { - printf(" %s='%s'", attr[i], attr[i + 1]); + printf("\n"); } - printf("\n"); - g_queue_push_head(parser->tag_stack, g_strdup(el)) ; + /* Push the current tag on to our stack of tags. */ + current_tag = g_new0(SaxTagStruct, 1) ; + current_tag->element_name = (char *)el ; + current_tag->attributes = (char **)attr ; + g_queue_push_head(parser->tag_stack, current_tag) ; parser->Depth++; @@ -176,29 +207,58 @@ static void end_tag(void *userData, const char *el) SaxParser parser = (SaxParser)userData ; int i ; gpointer dummy ; + SaxTag current_tag ; parser->Depth-- ; + dummy = g_queue_pop_head(parser->tag_stack) ; /* Now get rid of head element. */ + + current_tag = (SaxTag)dummy ; + + /* If there is content between the start/end tags process it. */ if (parser->content->len) { + +#ifdef ED_G_NEVER_INCLUDE_THIS_CODE gchar *tag = (gchar *)g_queue_peek_head(parser->tag_stack) ; +#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */ - for (i = 0; i < parser->Depth; i++) - printf(" "); - printf("content(<%s>) - %s\n", tag, parser->content->str) ; + if (parser->debug) + { + for (i = 0; i < parser->Depth; i++) + printf(" "); - /* reset once printed..... */ + printf("%s content - %s\n", current_tag->element_name, parser->content->str) ; + } + + + /* Here is where we need to do some of the (most of the ?) gff processing.... */ + + + /* reset once processed..... */ parser->content = g_string_set_size(parser->content, 0) ; } + +#ifdef ED_G_NEVER_INCLUDE_THIS_CODE dummy = g_queue_pop_head(parser->tag_stack) ; /* Now get rid of head element. */ + + current_tag = (SaxTag)dummy ; +#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */ + + + g_free(dummy) ; - for (i = 0; i < parser->Depth; i++) - printf(" "); - printf("</%s>\n", el); + if (parser->debug) + { + for (i = 0; i < parser->Depth; i++) + printf(" ") ; + + printf("</%s>\n", el) ; + } return ; } diff --git a/src/zmapServer/zmapServer.c b/src/zmapServer/zmapServer.c index b4833b68e96481d5a7e4adbba01d3e1235cf40a5..91476f463bea2f5c847676c297d6cea7163325bc 100755 --- a/src/zmapServer/zmapServer.c +++ b/src/zmapServer/zmapServer.c @@ -26,9 +26,9 @@ * Description: * Exported functions: See zmapServer.h * HISTORY: - * Last edited: Jul 15 12:36 2004 (edgrif) + * Last edited: Jul 16 09:38 2004 (edgrif) * Created: Wed Aug 6 15:46:38 2003 (edgrif) - * CVS info: $Id: zmapServer.c,v 1.5 2004-07-15 15:11:56 edgrif Exp $ + * CVS info: $Id: zmapServer.c,v 1.6 2004-07-16 08:46:21 edgrif Exp $ *------------------------------------------------------------------- */ @@ -50,7 +50,7 @@ gboolean zMapServerGlobalInit(char *protocol, void **server_global_data_out) gboolean result = TRUE ; ZMapServerFuncs serverfuncs ; - serverfuncs = g_new(ZMapServerFuncsStruct, sizeof(ZMapServerFuncsStruct)) ; /* n.b. crashes on failure. */ + serverfuncs = g_new0(ZMapServerFuncsStruct, sizeof(ZMapServerFuncsStruct)) ; /* n.b. crashes on failure. */ /* Set up the server according to the protocol, this is all a bit hard coded but it * will do for now.... */ diff --git a/src/zmapThreads/zmapConn.c b/src/zmapThreads/zmapConn.c index 2f7a81adf9647f50c1a47fc953e41d8acd29a151..95566832c8dc4fa99b67ea482a23fdf3c93ed453 100755 --- a/src/zmapThreads/zmapConn.c +++ b/src/zmapThreads/zmapConn.c @@ -26,9 +26,9 @@ * Description: * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: - * Last edited: Apr 8 16:24 2004 (edgrif) + * Last edited: Jul 16 09:39 2004 (edgrif) * Created: Thu Jul 24 14:37:18 2003 (edgrif) - * CVS info: $Id: zmapConn.c,v 1.5 2004-04-08 16:50:04 edgrif Exp $ + * CVS info: $Id: zmapConn.c,v 1.6 2004-07-16 08:46:24 edgrif Exp $ *------------------------------------------------------------------- */ @@ -220,7 +220,7 @@ static ZMapConnection createConnection(char *machine, int port, char *protocol, { ZMapConnection connection ; - connection = g_new(ZMapConnectionStruct, sizeof(ZMapConnectionStruct)) ; + connection = g_new0(ZMapConnectionStruct, sizeof(ZMapConnectionStruct)) ; connection->machine = g_strdup(machine) ; connection->port = port ; diff --git a/src/zmapThreads/zmapSlave.c b/src/zmapThreads/zmapSlave.c index f2b0b20201df6e9381fa349cbdd6c1375ca84489..0a4da5ba94c2a440cd2108730eb03df08cddd02d 100755 --- a/src/zmapThreads/zmapSlave.c +++ b/src/zmapThreads/zmapSlave.c @@ -26,9 +26,9 @@ * Description: * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: - * Last edited: Jun 25 12:17 2004 (edgrif) + * Last edited: Jul 16 09:39 2004 (edgrif) * Created: Thu Jul 24 14:37:26 2003 (edgrif) - * CVS info: $Id: zmapSlave.c,v 1.6 2004-06-25 13:39:42 edgrif Exp $ + * CVS info: $Id: zmapSlave.c,v 1.7 2004-07-16 08:46:25 edgrif Exp $ *------------------------------------------------------------------- */ @@ -101,7 +101,7 @@ void *zmapNewThread(void *thread_args) ZMAP_THR_DEBUG(("%x: main thread routine starting....\n", connection->thread_id)) ; - thread_cb = g_new(zmapThreadCBstruct, sizeof(zmapThreadCBstruct)) ; + thread_cb = g_new0(zmapThreadCBstruct, sizeof(zmapThreadCBstruct)) ; thread_cb->connection = connection ; thread_cb->thread_died = FALSE ; thread_cb->initial_error = NULL ; @@ -351,7 +351,7 @@ static void protocolGlobalInitFunc(ZMapProtocolInitList protocols, char *protoco /* If we don't find the protocol in the list then add it, initialised to FALSE. */ if (!(curr_ptr = g_list_find_custom(protocols->protocol_list, protocol, findProtocol))) { - init = (ZMapProtocolInit)g_new(ZMapProtocolInitStruct, 1) ; + init = (ZMapProtocolInit)g_new0(ZMapProtocolInitStruct, 1) ; init->protocol = g_strdup(protocol) ; init->init_called = init->cleanup_called = FALSE ; init->global_init_data = NULL ; diff --git a/src/zmapThreads/zmapSlave.test.c b/src/zmapThreads/zmapSlave.test.c index d8026e96d72d50572c47d3fd8e5928446f04b504..b05b581670db0526a4dccc5545238aa90b0c0687 100755 --- a/src/zmapThreads/zmapSlave.test.c +++ b/src/zmapThreads/zmapSlave.test.c @@ -26,9 +26,9 @@ * Description: * Exported functions: See XXXXXXXXXXXXX.h * HISTORY: - * Last edited: Aug 6 10:16 2003 (edgrif) + * Last edited: Jul 16 09:39 2004 (edgrif) * Created: Thu Jul 24 14:37:26 2003 (edgrif) - * CVS info: $Id: zmapSlave.test.c,v 1.1 2003-11-13 15:02:13 edgrif Exp $ + * CVS info: $Id: zmapSlave.test.c,v 1.2 2004-07-16 08:46:26 edgrif Exp $ *------------------------------------------------------------------- */ @@ -67,7 +67,7 @@ void *zmapNewThread(void *thread_args) ZMapThreadRequest signalled_state ; - thread_cb = g_new(zmapThreadCBstruct, sizeof(zmapThreadCBstruct)) ; + thread_cb = g_new0(zmapThreadCBstruct, sizeof(zmapThreadCBstruct)) ; thread_cb->connection = connection ; thread_cb->thread_died = FALSE ; diff --git a/src/zmapUtils/zmapLogging.c b/src/zmapUtils/zmapLogging.c index 6fad573febfe2dd5d6e0afd4ed657cc906585271..ca70987dd16878606cb071807289ef15122451a3 100755 --- a/src/zmapUtils/zmapLogging.c +++ b/src/zmapUtils/zmapLogging.c @@ -25,9 +25,9 @@ * Description: * Exported functions: See ZMap/zmapUtils.h * HISTORY: - * Last edited: May 27 11:14 2004 (edgrif) + * Last edited: Jul 16 09:40 2004 (edgrif) * Created: Thu Apr 29 14:59:37 2004 (edgrif) - * CVS info: $Id: zmapLogging.c,v 1.3 2004-05-27 13:43:04 edgrif Exp $ + * CVS info: $Id: zmapLogging.c,v 1.4 2004-07-16 08:46:27 edgrif Exp $ *------------------------------------------------------------------- */ @@ -151,7 +151,7 @@ static ZMapLog createLog(void) { ZMapLog log ; - log = g_new(ZMapLogStruct, sizeof(ZMapLogStruct)) ; + log = g_new0(ZMapLogStruct, sizeof(ZMapLogStruct)) ; /* Default will be logging active. */ log->logging = TRUE ; diff --git a/src/zmapUtils/zmapReadLine.c b/src/zmapUtils/zmapReadLine.c index 38c09e646ccf1cb5d68da4dcf3f763e7b22197e0..a11568a6435b43b67626cd726385052c76632a0d 100755 --- a/src/zmapUtils/zmapReadLine.c +++ b/src/zmapUtils/zmapReadLine.c @@ -29,9 +29,9 @@ * * Exported functions: See ZMap/zmapReadLine.h * HISTORY: - * Last edited: Jun 25 09:52 2004 (edgrif) + * Last edited: Jul 16 09:40 2004 (edgrif) * Created: Thu Jun 24 19:03:50 2004 (edgrif) - * CVS info: $Id: zmapReadLine.c,v 1.1 2004-06-25 13:30:25 edgrif Exp $ + * CVS info: $Id: zmapReadLine.c,v 1.2 2004-07-16 08:46:28 edgrif Exp $ *------------------------------------------------------------------- */ @@ -62,7 +62,7 @@ ZMapReadLine zMapReadLineCreate(char *input_lines, gboolean in_place) { ZMapReadLine read_line ; - read_line = g_new(ZMapReadLineStruct, 1) ; + read_line = g_new0(ZMapReadLineStruct, 1) ; read_line->original = input_lines ; read_line->current = read_line->next = NULL ; diff --git a/src/zmapView/zmapView.c b/src/zmapView/zmapView.c index e1e710c2b4ce43812b2b92c436ed0938366b6fea..c8133966fcd7995f1783792b3b87449ebf2cc66f 100755 --- a/src/zmapView/zmapView.c +++ b/src/zmapView/zmapView.c @@ -25,9 +25,9 @@ * Description: * Exported functions: See ZMap/zmapView.h * HISTORY: - * Last edited: Jul 15 15:56 2004 (edgrif) + * Last edited: Jul 16 09:42 2004 (edgrif) * Created: Thu May 13 15:28:26 2004 (edgrif) - * CVS info: $Id: zmapView.c,v 1.6 2004-07-15 15:13:03 edgrif Exp $ + * CVS info: $Id: zmapView.c,v 1.7 2004-07-16 08:46:30 edgrif Exp $ *------------------------------------------------------------------- */ @@ -593,7 +593,7 @@ static ZMapView createZMapView(char *sequence, void *app_data) { ZMapView zmap_view = NULL ; - zmap_view = g_new(ZMapViewStruct, 1) ; + zmap_view = g_new0(ZMapViewStruct, 1) ; zmap_view->state = ZMAPVIEW_INIT ; diff --git a/src/zmapWindow/zmapWindow.c b/src/zmapWindow/zmapWindow.c index 48dfa10832dd19f9efdd5e0aba4a8d1c893a0810..2f2cdce3b79c785765012679e32312c2cfe63d11 100755 --- a/src/zmapWindow/zmapWindow.c +++ b/src/zmapWindow/zmapWindow.c @@ -28,9 +28,9 @@ * * Exported functions: See ZMap/zmapWindow.h * HISTORY: - * Last edited: Jul 15 15:00 2004 (rnc) + * Last edited: Jul 16 09:41 2004 (edgrif) * Created: Thu Jul 24 14:36:27 2003 (edgrif) - * CVS info: $Id: zmapWindow.c,v 1.18 2004-07-15 16:34:12 rnc Exp $ + * CVS info: $Id: zmapWindow.c,v 1.19 2004-07-16 08:46:29 edgrif Exp $ *------------------------------------------------------------------- */ @@ -93,7 +93,7 @@ ZMapWindow zMapWindowCreate(GtkWidget *parent_widget, char *sequence, void *app_ zMapAssert(parent_widget && sequence && *sequence && app_data) ; - window = g_new(ZMapWindowStruct, 1) ; + window = g_new0(ZMapWindowStruct, 1) ; window->sequence = g_strdup(sequence) ; window->app_data = app_data ; window->parent_widget = parent_widget ; @@ -189,7 +189,7 @@ void zMapWindowDisplayData(ZMapWindow window, void *data) zmapWindowData window_data ; /* Set up struct to be passed to our callback. */ - window_data = g_new(zmapWindowDataStruct, sizeof(zmapWindowDataStruct)) ; + window_data = g_new0(zmapWindowDataStruct, sizeof(zmapWindowDataStruct)) ; window_data->window = window ; window_data->data = data ;