MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / split_newlines

Function split_newlines

arch/powerpc/assembler.cpp:2632–2668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2630/*****************************************************************************/
2631
2632int split_newlines(const string& chunk, vector<string> &lines)
2633{
2634 lines.clear();
2635
2636 const char *p = chunk.c_str();
2637
2638 unsigned i=0, left=0;
2639 while(1) {
2640 if(p[i]=='\x00') {
2641 if(left < i) {
2642 lines.push_back(string(p,left,i-left));
2643 }
2644
2645 break;
2646 }
2647
2648 if(p[i]=='\x0a') {
2649 if(left < i) {
2650 lines.push_back(string(p,left,i-left));
2651 }
2652
2653 left = i = (i+1);
2654 }
2655 else if(i+1 < chunk.size() && p[i]=='\x0d' && p[i+1]=='\x0a') {
2656 if(left < i) {
2657 lines.push_back(string(p,left,i-left));
2658 }
2659
2660 left = i = (i+2);
2661 }
2662 else {
2663 i += 1;
2664 }
2665 }
2666
2667 return 0;
2668}
2669
2670int trim_lines(vector<string> &lines)
2671{

Callers 1

assemble_multilineFunction · 0.85

Calls 4

c_strMethod · 0.80
push_backMethod · 0.80
clearMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected