diff --git a/source/utils/CarlaPipeUtils.cpp b/source/utils/CarlaPipeUtils.cpp index 30ba1d154..7b25a127f 100644 --- a/source/utils/CarlaPipeUtils.cpp +++ b/source/utils/CarlaPipeUtils.cpp @@ -1,6 +1,6 @@ /* * Carla Pipe Utilities - * Copyright (C) 2013-2022 Filipe Coelho + * Copyright (C) 2013-2023 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -870,6 +870,13 @@ bool CarlaPipeCommon::readNextLineAsString(const char*& value, const bool alloca return false; } +char* CarlaPipeCommon::readNextLineAsString() const noexcept +{ + CARLA_SAFE_ASSERT_RETURN(pData->isReading, nullptr); + + return const_cast(_readlineblock(true, 0)); +} + // ------------------------------------------------------------------- // must be locked before calling diff --git a/source/utils/CarlaPipeUtils.hpp b/source/utils/CarlaPipeUtils.hpp index a15722f13..7112be5dc 100644 --- a/source/utils/CarlaPipeUtils.hpp +++ b/source/utils/CarlaPipeUtils.hpp @@ -1,6 +1,6 @@ /* * Carla Pipe utils - * Copyright (C) 2013-2018 Filipe Coelho + * Copyright (C) 2013-2023 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -140,10 +140,15 @@ public: /*! * Read the next line as a string. - * @note: @a value must be deleted if valid. + * @note: @a value must be freed if valid and allocateString is true. */ bool readNextLineAsString(const char*& value, bool allocateString, uint32_t size = 0) const noexcept; + /*! + * Read the next line as a string, returning an allocated copy that needs to be freed. + */ + char* readNextLineAsString() const noexcept; + // ------------------------------------------------------------------- // write messages, must be locked before calling