Changeset 881 for branches


Ignore:
Timestamp:
Sep 12, 2018, 6:05:49 PM (6 years ago)
Author:
djay
Message:

Make sure to initialize properly every field of a service.

Location:
branches/prototype-v0/zoo-project/zoo-kernel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/prototype-v0/zoo-project/zoo-kernel/service.c

    r877 r881  
    452452}
    453453
     454
     455/**
     456 * Allocate memory for a service.
     457 * Require to call free after calling this function.
     458 *
     459 * @return the service
     460 */
     461service* createService(){
     462  service *s1 = (service *) malloc (SERVICE_SIZE);
     463  s1->name=NULL;
     464  s1->content=NULL;
     465  s1->metadata=NULL;
     466  s1->additional_parameters=NULL;
     467  s1->inputs=NULL;
     468  s1->outputs=NULL;
     469  return s1;
     470}
     471
    454472/**
    455473 * Free allocated memory of a service.
    456  * Require to call free on e after calling this function.
     474 * Require to be invoked for every createService call.
    457475 *
    458476 * @param s the service to free
  • branches/prototype-v0/zoo-project/zoo-kernel/service.h

    r877 r881  
    296296  ZOO_DLL_EXPORT void freeElements(elements**);
    297297  ZOO_DLL_EXPORT void setServiceName(service**,char*);
     298  ZOO_DLL_EXPORT service* createService();
    298299  ZOO_DLL_EXPORT void freeService(service**);
    299300  ZOO_DLL_EXPORT void addToMap(map*,const char*,const char*);
  • branches/prototype-v0/zoo-project/zoo-kernel/zoo_service_loader.c

    r880 r881  
    337337            map* import = getMapFromMaps (m, IMPORTSERVICE, tmpsn);
    338338            if (import == NULL || import->value == NULL || zoo_path_compare(tmps1, import->value) != 0 ) { // service is not in [include] block
    339               service *s1 = (service *) malloc (SERVICE_SIZE);
     339              service *s1 = createService();
    340340              if (s1 == NULL)
    341341                {
     
    15231523                        if(s2==NULL){
    15241524#endif
    1525                           s1 = (service *) malloc (SERVICE_SIZE);
     1525                          s1 = createService();
    15261526                          t = readServiceFile (m, import->value, &s1, import->name);
    15271527               
     
    15861586                         #endif
    15871587                        */
    1588                         s1 = (service *) malloc (SERVICE_SIZE);
     1588                        s1 = createService();
    15891589                        t = readServiceFile (m, buff1, &s1, tmpMapI->value);
    15901590                        if (t < 0)
     
    16711671                                  snprintf (buff1, 1024, "%s/%s", conf_dir,
    16721672                                            dp->d_name);
    1673                                   s1 = (service *) malloc (SERVICE_SIZE);
     1673                                  s1 = createService();
    16741674                                  if (s1 == NULL)
    16751675                                    {
     
    19271927  }else /* Not found in MetaDB */{
    19281928#endif
    1929     s1 = (service *) malloc (SERVICE_SIZE);
     1929    s1 = createService();
    19301930    if (s1 == NULL)
    19311931      {
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png