/*! \brief This function concatenates the \a other to this */ void XsString_append(XsString* thisPtr, XsString const* other) { if (other && other->m_size > 1) { // remove terminating null from this and append arrays XsArray_erase(thisPtr, thisPtr->m_size-1, 1); XsArray_append(thisPtr, other); if (thisPtr == other) { // add terminating null again static const char nullChar = 0; XsArray_insert(thisPtr, (XsSize) -1, 1, &nullChar); } } }
/*! \relates XsVersion \brief Get a string with the version expressed in a readable format. */ void XsVersion_toString(const XsVersion* thisPtr, XsString* version) { char buffer[256]; size_t chars; if (XsVersion_empty(thisPtr)) return; if (thisPtr->m_build != 0) chars = sprintf(buffer, "%d.%d.%d rev %d", thisPtr->m_major, thisPtr->m_minor, thisPtr->m_revision, thisPtr->m_build); else chars = sprintf(buffer, "%d.%d.%d", thisPtr->m_major, thisPtr->m_minor, thisPtr->m_revision); XsString_assign(version, chars, buffer); if (thisPtr->m_extra.m_size != 0) { const char space = ' '; XsArray_insert(version, version->m_size-1, 1, &space); //lint !e64 XsString_append(version, &thisPtr->m_extra); } }