Advertisement
Tkap1

Untitled

Sep 24th, 2022 (edited)
940
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1.  
  2. char* case_str = find_word(buffer, "case ");
  3.  
  4. char* first_brace = case_str;
  5. while(true)
  6. {
  7.     if(*first_brace == 0) { assert(false); }
  8.     if(*first_brace == '{') { break; }
  9.     first_brace++;
  10. }
  11.  
  12. int brace_count = 1;
  13.  
  14. char last_brace = first_brace + 1;
  15. while(true)
  16. {
  17.     if(*last_brace == 0) { assert(false); }
  18.     if(*last_brace == '{') { brace_count++; }
  19.     if(*last_brace == '}')
  20.     {
  21.         brace_count--;
  22.         if(brace_count == 0)
  23.         {
  24.             break;
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement