Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/collections/string_res.cfa

    r9018dcf red5023d1  
    1010// Created On       : Fri Sep 03 11:00:00 2021
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Apr  9 08:44:17 2025
    13 // Update Count     : 128
     12// Last Modified On : Sun Apr  6 07:38:02 2025
     13// Update Count     : 111
    1414//
    1515
     
    190190const char * DEBUG_string_heap_start( VbyteHeap * heap ) {
    191191        return heap->StartVbyte;
     192}
     193
     194// Returns the size of the string in bytes
     195size_t len(const string_res & s) with(s) {
     196        return Handle.lnth;
    192197}
    193198
     
    751756}
    752757
    753 // int find$( const string_res & s, ssize_t start, ssize_t len, const string_res & k, ssize_t kstart, ssize_t klen ) {
    754 //     if ( start < 0 ) start = s.Handle.lnth + start;          // adjust negative starting locations
    755 //     if ( kstart < 0 ) kstart = k.Handle.lnth + kstart;
    756 
    757 //      if ( start + len > s.Handle.lnth ) return start + 1;  // cannot be there
    758 //      if ( kstart + len > k.Handle.lnth ) return start + 1;
    759 //      if ( klen > len ) return start + 1;
    760 
    761 //      int i, r;
    762 
    763 //      for ( i = max( start, 1 ); ; i += 1 ) {
    764 //              if ( i > s.Handle.lnth - k.Handle.lnth + 1 ) {
    765 //                      r = s.Handle.lnth + 1;
    766 //                      break;
    767 //          } // exit
    768 //              if ( HeapArea->ByteCmp( s.Handle.s, i, k.Handle.lnth, k.Handle.s, 1, k.Handle.lnth ) == 0 ) {
    769 //                      r = i;
    770 //                      break;
    771 //          } // exit
    772 //      } // for
    773 //      return r;
    774 // }
    775 
    776 int find( const string_res & s, char search ) {
     758int find(const string_res & s, char search) {
    777759        return findFrom(s, 0, search);
    778760}
    779761
    780 int findFrom( const string_res & s, size_t fromPos, char search ) {
     762int findFrom(const string_res & s, size_t fromPos, char search) {
    781763        // FIXME: This paricular overload (find of single char) is optimized to use memchr.
    782764        // The general overload (find of string, memchr applying to its first character) and `contains` should be adjusted to match.
Note: See TracChangeset for help on using the changeset viewer.