Skip to content
This repository was archived by the owner on Dec 6, 2024. It is now read-only.

Commit fe77a78

Browse files
prepare 2.3.3 release (#33)
1 parent 14a974b commit fe77a78

File tree

6 files changed

+43
-44
lines changed

6 files changed

+43
-44
lines changed

c-sdk-common/test-utils/include/test-utils/http_server.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#pragma once
22

3-
#include <stdbool.h>
4-
3+
#include <launchdarkly/boolean.h>
54
#include <launchdarkly/json.h>
65

76
#ifdef _WIN32
@@ -16,7 +15,7 @@
1615
#endif
1716

1817
struct LDHTTPRequest {
19-
bool done;
18+
LDBoolean done;
2019
char *requestURL;
2120
char *requestMethod;
2221
char *requestBody;

c-sdk-common/test-utils/src/http_server.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ LDHTTPRequestInit(struct LDHTTPRequest *const request)
7373
{
7474
LD_ASSERT(request);
7575

76-
request->done = false;
76+
request->done = LDBooleanFalse;
7777
request->requestURL = NULL;
7878
request->requestMethod = NULL;
7979
request->requestBody = NULL;
@@ -240,7 +240,7 @@ LDi_onMessageComplete(http_parser *const parser)
240240
request = (struct LDHTTPRequest *)parser->data;
241241
LD_ASSERT(request);
242242

243-
request->done = true;
243+
request->done = LDBooleanTrue;
244244

245245
return 0;
246246
}

src/evaluate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ addValue(
106106
*result = tmp;
107107
} else {
108108
*result = NULL;
109-
details->hasVariation = false;
109+
details->hasVariation = LDBooleanFalse;
110110
}
111111

112112
return LDBooleanTrue;
@@ -584,7 +584,7 @@ LDi_checkPrerequisites(
584584

585585
{
586586
struct LDJSON *on;
587-
bool variationMatch = false;
587+
LDBoolean variationMatch = LDBooleanFalse;
588588

589589
if (!(on = LDObjectLookup(preflag, "on"))) {
590590
LDJSONRCDecrement(preflagrc);

src/events.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include <stdbool.h>
21
#include <stdio.h>
32
#include <stdlib.h>
43
#include <string.h>
@@ -29,7 +28,7 @@ LDi_notNull(const struct LDJSON *const json)
2928

3029
struct AnalyticsContext
3130
{
32-
bool active;
31+
LDBoolean active;
3332
double lastFlush;
3433
struct curl_slist *headers;
3534
struct LDClient * client;
@@ -59,22 +58,22 @@ done(
5958
const int responseCode)
6059
{
6160
struct AnalyticsContext *context;
62-
const bool success = responseCode == 200 || responseCode == 202;
61+
const LDBoolean success = responseCode == 200 || responseCode == 202;
6362

6463
LD_ASSERT(client);
6564
LD_ASSERT(rawcontext);
6665

6766
context = (struct AnalyticsContext *)rawcontext;
6867

69-
context->active = false;
68+
context->active = LDBooleanFalse;
7069

7170
LD_LOG(LD_LOG_TRACE, "events network interface called done");
7271

7372
if (success) {
7473
LD_LOG(LD_LOG_TRACE, "event batch send successful");
7574

7675
LDi_rwlock_wrlock(&client->lock);
77-
client->shouldFlush = false;
76+
client->shouldFlush = LDBooleanFalse;
7877
LDi_rwlock_wrunlock(&client->lock);
7978

8079
LDi_getMonotonicMilliseconds(&context->lastFlush);
@@ -208,13 +207,13 @@ poll(struct LDClient *const client, void *const rawcontext)
208207
struct AnalyticsContext *context;
209208
char url[4096];
210209
const char * mime, *schema;
211-
bool shouldFlush;
212-
bool lastFailed;
210+
LDBoolean shouldFlush;
211+
LDBoolean lastFailed;
213212

214213
LD_ASSERT(rawcontext);
215214

216215
curl = NULL;
217-
shouldFlush = false;
216+
shouldFlush = LDBooleanFalse;
218217
mime = "Content-Type: application/json";
219218
schema = "X-LaunchDarkly-Event-Schema: 3";
220219
context = (struct AnalyticsContext *)rawcontext;
@@ -266,7 +265,7 @@ poll(struct LDClient *const client, void *const rawcontext)
266265
if (!events) {
267266
/* no events to send */
268267
LDi_rwlock_wrlock(&client->lock);
269-
shouldFlush = false;
268+
shouldFlush = LDBooleanFalse;
270269
LDi_rwlock_wrunlock(&client->lock);
271270

272271
return NULL;
@@ -360,7 +359,7 @@ poll(struct LDClient *const client, void *const rawcontext)
360359
goto error;
361360
}
362361

363-
context->active = true;
362+
context->active = LDBooleanTrue;
364363

365364
return curl;
366365

@@ -395,7 +394,7 @@ LDi_constructAnalytics(struct LDClient *const client)
395394
goto error;
396395
}
397396

398-
context->active = false;
397+
context->active = LDBooleanFalse;
399398
context->headers = NULL;
400399
context->client = client;
401400
context->buffer = NULL;

tests/test-config.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#include <stdbool.h>
21
#include <string.h>
32

43
#include <launchdarkly/api.h>
4+
#include <launchdarkly/boolean.h>
55

66
#include "assertion.h"
77
#include "config.h"
@@ -36,13 +36,13 @@ testDefaultAndReplace()
3636
LD_ASSERT(LDConfigSetEventsURI(config, "https://test6.com"));
3737
LD_ASSERT(strcmp(config->eventsURI, "https://test6.com") == 0);
3838

39-
LD_ASSERT(config->stream == true);
40-
LDConfigSetStream(config, false);
41-
LD_ASSERT(config->stream == false);
39+
LD_ASSERT(config->stream == LDBooleanTrue);
40+
LDConfigSetStream(config, LDBooleanFalse);
41+
LD_ASSERT(config->stream == LDBooleanFalse);
4242

43-
LD_ASSERT(config->sendEvents == true);
44-
LDConfigSetSendEvents(config, false);
45-
LD_ASSERT(config->sendEvents == false);
43+
LD_ASSERT(config->sendEvents == LDBooleanTrue);
44+
LDConfigSetSendEvents(config, LDBooleanFalse);
45+
LD_ASSERT(config->sendEvents == LDBooleanFalse);
4646

4747
LD_ASSERT(config->eventsCapacity == 10000);
4848
LDConfigSetEventsCapacity(config, 50);
@@ -60,21 +60,21 @@ testDefaultAndReplace()
6060
LDConfigSetPollInterval(config, 20000);
6161
LD_ASSERT(config->pollInterval == 20000);
6262

63-
LD_ASSERT(config->offline == false);
64-
LDConfigSetOffline(config, true);
65-
LD_ASSERT(config->offline == true);
63+
LD_ASSERT(config->offline == LDBooleanFalse);
64+
LDConfigSetOffline(config, LDBooleanTrue);
65+
LD_ASSERT(config->offline == LDBooleanTrue);
6666

67-
LD_ASSERT(config->useLDD == false);
68-
LDConfigSetUseLDD(config, true);
69-
LD_ASSERT(config->useLDD == true);
67+
LD_ASSERT(config->useLDD == LDBooleanFalse);
68+
LDConfigSetUseLDD(config, LDBooleanTrue);
69+
LD_ASSERT(config->useLDD == LDBooleanTrue);
7070

71-
LD_ASSERT(config->allAttributesPrivate == false);
72-
LDConfigSetAllAttributesPrivate(config, true);
73-
LD_ASSERT(config->allAttributesPrivate == true);
71+
LD_ASSERT(config->allAttributesPrivate == LDBooleanFalse);
72+
LDConfigSetAllAttributesPrivate(config, LDBooleanTrue);
73+
LD_ASSERT(config->allAttributesPrivate == LDBooleanTrue);
7474

75-
LD_ASSERT(config->inlineUsersInEvents == false);
76-
LDConfigInlineUsersInEvents(config, true);
77-
LD_ASSERT(config->inlineUsersInEvents == true);
75+
LD_ASSERT(config->inlineUsersInEvents == LDBooleanFalse);
76+
LDConfigInlineUsersInEvents(config, LDBooleanTrue);
77+
LD_ASSERT(config->inlineUsersInEvents == LDBooleanTrue);
7878

7979
LD_ASSERT(config->userKeysCapacity == 1000);
8080
LDConfigSetUserKeysCapacity(config, 12);

tests/test-mock.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ makeBasicPutBody()
2424
LD_ASSERT(flags = LDNewObject());
2525
LD_ASSERT(segments = LDNewObject());
2626

27-
LD_ASSERT(flag = makeMinimalFlag("flag1", 52, true, false));
28-
LD_ASSERT(value = LDNewBool(true));
27+
LD_ASSERT(
28+
flag = makeMinimalFlag("flag1", 52, LDBooleanTrue, LDBooleanFalse));
29+
LD_ASSERT(value = LDNewBool(LDBooleanTrue));
2930
addVariation(flag, value);
3031
setFallthrough(flag, 0);
3132

@@ -117,13 +118,13 @@ testBasicPoll()
117118
LD_ASSERT(snprintf(pollURL, 1024, "http://127.0.0.1:%d", acceptPort) > 0);
118119

119120
LD_ASSERT(config = LDConfigNew("key"));
120-
LDConfigSetStream(config, false);
121+
LDConfigSetStream(config, LDBooleanFalse);
121122
LDConfigSetBaseURI(config, pollURL);
122123

123124
LD_ASSERT(client = LDClientInit(config, 1000 * 10));
124125
LD_ASSERT(user = LDUserNew("my-user"));
125126

126-
LD_ASSERT(LDBoolVariation(client, user, "flag1", false, NULL));
127+
LD_ASSERT(LDBoolVariation(client, user, "flag1", LDBooleanFalse, NULL));
127128

128129
LDUserFree(user);
129130
LDClientClose(client);
@@ -211,7 +212,7 @@ testBasicStream()
211212
LD_ASSERT(client = LDClientInit(config, 1000 * 10));
212213
LD_ASSERT(user = LDUserNew("my-user"));
213214

214-
LD_ASSERT(LDBoolVariation(client, user, "flag1", false, NULL));
215+
LD_ASSERT(LDBoolVariation(client, user, "flag1", LDBooleanFalse, NULL));
215216

216217
LDUserFree(user);
217218
LDClientClose(client);
@@ -253,7 +254,7 @@ testWrapperHeader_thread(void *const unused)
253254
NULL);
254255
break;
255256
default:
256-
LD_ASSERT(false);
257+
LD_ASSERT(LDBooleanFalse);
257258
break;
258259
}
259260

@@ -290,7 +291,7 @@ testWrapperHeader()
290291
/* do nothing */
291292
break;
292293
default:
293-
LD_ASSERT(false);
294+
LD_ASSERT(LDBooleanFalse);
294295
break;
295296
}
296297

0 commit comments

Comments
 (0)