nancy.liao
2025-04-18 a3fdd3589c713678eafe20840a7334de6bed038b
libscpi/src/utils.c
@@ -675,6 +675,8 @@
 *
 * prev and current should be in the same memory buffer
 */
 //组合复合SCPI命令
scpi_bool_t composeCompoundCommand(const scpi_token_t * prev, scpi_token_t * current) {
    size_t i;
@@ -687,6 +689,7 @@
        return TRUE;
    /* Common command or command root - nothing to do */
    // 当前命令是公共命令(*)或根命令(:)
    if (current->ptr[0] == '*' || current->ptr[0] == ':')
        return TRUE;
@@ -707,6 +710,7 @@
    current->ptr -= i;
    current->len += i;
    //复合命令组合
    memmove(current->ptr, prev->ptr, i);
    return TRUE;
}
@@ -754,7 +758,8 @@
#if USE_MEMORY_ALLOCATION_FREE && !HAVE_STRNDUP
char *OUR_strndup(const char *s, size_t n) {
    size_t len = SCPIDEFINE_strnlen(s, n);
    char * result = malloc(len + 1);
    //msvc下需要强转
    char * result =(char*) malloc(len + 1);
    if (!result) {
        return NULL;
    }