90:279f343bbf6c | 91:fac51f87def0 |
---|---|
51 //include "nspr.h" | 51 //include "nspr.h" |
52 #include <errno.h> | 52 #include <errno.h> |
53 | 53 |
54 #include "../daemon/netsite.h" | 54 #include "../daemon/netsite.h" |
55 #include "../public/nsapi.h" | 55 #include "../public/nsapi.h" |
56 #include <ucx/string.h> | |
57 #include <ucx/mempool.h> | |
56 | 58 |
57 #include "util.h" | 59 #include "util.h" |
58 | 60 |
59 | 61 |
60 | 62 |
482 // TODO: error | 484 // TODO: error |
483 newstr.length = 0; | 485 newstr.length = 0; |
484 return newstr; | 486 return newstr; |
485 } | 487 } |
486 if(s.length == 1) { | 488 if(s.length == 1) { |
487 newstr = sstrncat(3, newstr, parent, s, child); | 489 newstr = sstrncat(newstr, 3, parent, s, child); |
488 } else { | 490 } else { |
489 newstr = sstrncat(2, newstr, parent, child); | 491 newstr = sstrncat(newstr, 2, parent, child); |
490 } | 492 } |
491 newstr.ptr[newstr.length] = '\0'; | 493 newstr.ptr[newstr.length] = '\0'; |
492 | 494 |
493 return newstr; | 495 return newstr; |
494 } | 496 } |
566 } /* switch */ | 568 } /* switch */ |
567 } /* while */ | 569 } /* while */ |
568 | 570 |
569 return pb; | 571 return pb; |
570 } | 572 } |
573 | |
574 // TODO: remove | |
575 sstr_t sstrdup_mp(UcxMempool *pool, sstr_t s) { | |
576 sstr_t newstring; | |
577 newstring.ptr = (char*)ucx_mempool_malloc(pool, s.length + 1); | |
578 if (newstring.ptr != NULL) { | |
579 newstring.length = s.length; | |
580 newstring.ptr[newstring.length] = 0; | |
581 | |
582 memcpy(newstring.ptr, s.ptr, s.length); | |
583 } | |
584 | |
585 return newstring; | |
586 } |