mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-14 02:17:36 +08:00
Template strlen for any case other than char and wchar_t
This commit is contained in:
@@ -247,6 +247,13 @@ private:
|
||||
static inline size_t my_strlen(const wchar_t *s) {
|
||||
return wcslen(s);
|
||||
}
|
||||
template <typename X> static inline size_t my_strlen(const X *s) {
|
||||
size_t c = 0;
|
||||
|
||||
while ((*s++) != 0) c++;
|
||||
|
||||
return c;
|
||||
}
|
||||
private:
|
||||
void set_dest(dst_string &dst) { /* PRIVATE: External use can easily cause use-after-free bugs */
|
||||
set_dest(&dst[0],dst.size());
|
||||
|
Reference in New Issue
Block a user