Skip to content

Commit 47629d7

Browse files
Use mlib strings and vec types in TestSuite files
1 parent f97883e commit 47629d7

File tree

6 files changed

+241
-250
lines changed

6 files changed

+241
-250
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ ForEachMacros:
149149
- mlib_foreach_urange
150150
- mlib_foreach
151151
- mlib_foreach_arr
152+
- mlib_vec_foreach
152153
IfMacros:
153154
- mlib_assert_aborts
154155
- KJ_IF_MAYBE

src/common/src/mlib/str_vec.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* @file str_vec.h
3+
* @brief This file defines mstr_vec, a common "array of strings" type
4+
* @date 2025-09-30
5+
*
6+
* @copyright Copyright 2009-present MongoDB, Inc.
7+
*
8+
* Licensed under the Apache License, Version 2.0 (the "License");
9+
* you may not use this file except in compliance with the License.
10+
* You may obtain a copy of the License at
11+
*
12+
* http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing, software
15+
* distributed under the License is distributed on an "AS IS" BASIS,
16+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
* See the License for the specific language governing permissions and
18+
* limitations under the License.
19+
*/
20+
#ifndef MLIB_STR_VEC_H_INCLUDED
21+
#define MLIB_STR_VEC_H_INCLUDED
22+
23+
#include <mlib/config.h>
24+
#include <mlib/str.h>
25+
26+
#define T mstr
27+
#define VecDestroyElement(Ptr) (mstr_delete(*Ptr), Ptr->data = NULL, Ptr->len = 0)
28+
#define VecCopyElement(Dst, Src) (*Dst = mstr_copy(*Src), Dst->data != NULL)
29+
#include <mlib/vec.t.h>
30+
31+
#endif // MLIB_STR_VEC_H_INCLUDED

0 commit comments

Comments
 (0)