700 |
700 |
701 if(matchedRepoNode) { |
701 if(matchedRepoNode) { |
702 xmlNodePtr prev = matchedRepoNode->prev; |
702 xmlNodePtr prev = matchedRepoNode->prev; |
703 xmlNodePtr next = matchedRepoNode->next; |
703 xmlNodePtr next = matchedRepoNode->next; |
704 if(prev && prev->type == XML_TEXT_NODE) { |
704 if(prev && prev->type == XML_TEXT_NODE) { |
705 sstr_t content = sstr(prev->content); |
705 sstr_t content = sstr((char*)prev->content); |
706 sstr_t lf = sstrrchr(content, '\n'); |
706 sstr_t lf = sstrrchr(content, '\n'); |
707 if(lf.length > 0) { |
707 if(lf.length > 0) { |
708 *lf.ptr = '\0'; |
708 *lf.ptr = '\0'; |
709 char* newcontent = sstrdup(content).ptr; |
709 char* newcontent = sstrdup(content).ptr; |
710 xmlNodeSetContent(prev, newcontent); |
710 xmlNodeSetContent(prev, (xmlChar*)newcontent); |
711 free(newcontent); |
711 free(newcontent); |
712 } |
712 } |
713 } |
713 } |
714 if(next && next->type == XML_TEXT_NODE) { |
714 if(next && next->type == XML_TEXT_NODE) { |
715 sstr_t lf = sstrchr(sstr(next->content), '\n'); |
715 sstr_t lf = sstrchr(sstr((char*)next->content), '\n'); |
716 if(lf.length > 0) { |
716 if(lf.length > 0) { |
717 char* newcontent = malloc(lf.length); |
717 char* newcontent = malloc(lf.length); |
718 memcpy(newcontent, lf.ptr+1, lf.length-1); |
718 memcpy(newcontent, lf.ptr+1, lf.length-1); |
719 newcontent[lf.length-1] = '\0'; |
719 newcontent[lf.length-1] = '\0'; |
720 xmlNodeSetContent(next, newcontent); |
720 xmlNodeSetContent(next, (xmlChar*)newcontent); |
721 free(newcontent); |
721 free(newcontent); |
722 } |
722 } |
723 } |
723 } |
724 |
724 |
725 xmlUnlinkNode(matchedRepoNode); |
725 xmlUnlinkNode(matchedRepoNode); |