source
sysutil.c
line
372 - 403
function
372 static void
373 str_split_text_common(struct mystr* p_src, struct mystr* p_rhs,
374 const char* p_text, int is_reverse)
375 {
376 struct str_locate_result locate_result;
377 unsigned int indexx;
378 unsigned int search_len = vsf_sysutil_strlen(p_text);
379 if (is_reverse)
380 {
381 locate_result = str_locate_text_reverse(p_src, p_text);
382 }
383 else
384 {
385 locate_result = str_locate_text(p_src, p_text);
386 }
387 /* Not found? */
388 if (!locate_result.found)
389 {
390 str_empty(p_rhs);
391 return;
392 }
393 indexx = locate_result.index;
394 if (indexx + search_len > p_src->len)
395 {
396 bug("indexx invalid in str_split_text");
397 }
398 /* Build rhs */
399 private_str_alloc_memchunk(p_rhs, p_src->p_buf + indexx + search_len,
400 p_src->len - indexx - search_len);
401 /* Build lhs */
402 str_trunc(p_src, indexx);
403 }
最終更新:2009年02月08日 13:12