MCPcopy Index your code
hub / github.com/MapServer/MapServer / insertFeatureList

Function insertFeatureList

mapfile.c:761–791  ·  view source on GitHub ↗

inserts a feature at the end of the list, can create a new list */

Source from the content-addressed store, hash-verified

759
760/* inserts a feature at the end of the list, can create a new list */
761featureListNodeObjPtr insertFeatureList(featureListNodeObjPtr *list, shapeObj *shape)
762{
763 featureListNodeObjPtr node;
764
765 node = (featureListNodeObjPtr) malloc(sizeof(featureListNodeObj));
766 MS_CHECK_ALLOC(node, sizeof(featureListNodeObj), NULL);
767
768 msInitShape(&(node->shape));
769 if(msCopyShape(shape, &(node->shape)) == -1) return(NULL);
770
771 /* AJS - alans@wunderground.com O(n^2) -> O(n) conversion, keep a pointer to the end */
772
773 /* set the tailifhead to NULL, since it is only set for the head of the list */
774 node->tailifhead = NULL;
775 node->next = NULL;
776
777 /* if we are at the head of the list, we need to set the list to node, before pointing tailifhead somewhere */
778 if(*list == NULL) {
779 *list=node;
780 } else {
781 if((*list)->tailifhead!=NULL) /* this should never be NULL, but just in case */
782 (*list)->tailifhead->next=node; /* put the node at the end of the list */
783 }
784
785 /* repoint the head of the list to the end - our new element
786 this causes a loop if we are at the head, be careful not to
787 walk in a loop */
788 (*list)->tailifhead = node;
789
790 return(node); /* a pointer to last object in the list */
791}
792
793void freeFeatureList(featureListNodeObjPtr list)
794{

Callers 5

msDrawVectorLayerFunction · 0.85
msDrawQueryLayerFunction · 0.85
msCopyLayerFunction · 0.85
loadFeatureFunction · 0.85
layerObj_addFeatureFunction · 0.85

Calls 2

msInitShapeFunction · 0.85
msCopyShapeFunction · 0.85

Tested by

no test coverage detected