Ignore:
Timestamp:
Jan 17, 2024, 2:16:04 PM (5 months ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
master
Children:
5bf685f
Parents:
06280ad
Message:

Tweak string assignment-strcpy-strncpy and concatenate-strcat-strncat declarations.

Implement -n- versions correctly.

Refactor to include string_res layer.

Add missing tests.

File:
1 edited

Legend:

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

    r06280ad re891349  
    8888}
    8989
     90string_res & assign(string_res & s, const string_res & src, size_t maxlen); // copy specific length from other string
    9091string_res & assign(string_res & s, const char * buffer, size_t bsize); // copy specific length from buffer
    9192static inline string_res & ?=?(string_res & s, const char * c) {  // copy from string literal (NULL-terminated)
     
    129130
    130131// Concatenation
     132void ?+=?(string_res & s, const string_res & s2);
     133void ?+=?(string_res & s, char c);
     134void append(string_res & s, const string_res & s2, size_t maxlen);
     135void ?+=?(string_res & s, const char * c);
    131136void append(string_res & s, const char * buffer, size_t bsize);
    132 void ?+=?(string_res & s, char c); // append a character
    133 void ?+=?(string_res & s, const string_res & s2); // append-concatenate to first string
    134 static inline void ?+=?(string_res & s, const char * c) {
    135     append( s, c, strlen(c) );
    136 }
     137
     138static inline string_res & strcat(string_res & s, const string_res & s2) { s += s2; return s; }
     139static inline string_res & strcat(string_res & s, const char * c) { s += c; return s; }
     140static inline string_res & strncat(string_res & s, const string_res & s2, size_t maxlen) { append(s, s2, maxlen); return s; }
     141static inline string_res & strncat(string_res & s, const char * buffer, size_t bsize) { append(s, buffer, bsize); return s; }
    137142
    138143// Repetition
Note: See TracChangeset for help on using the changeset viewer.