Skip to content

Commit 0305481

Browse files
authored
docs: make usage of LDPersistence_Init clearer (#460)
This commit provides better documentation for how to initialize the `LDPersistence` struct. The existing docs were ambiguous as to when the call should be made. If you call _after_ setting custom pointers, then the custom pointers will be wiped out.
1 parent 1babc17 commit 0305481

File tree

1 file changed

+19
-3
lines changed
  • libs/client-sdk/include/launchdarkly/client_side/bindings/c/config

1 file changed

+19
-3
lines changed

libs/client-sdk/include/launchdarkly/client_side/bindings/c/config/builder.h

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,25 @@ struct LDPersistence {
8888
};
8989

9090
/**
91-
* Initializes a custom persistence implementation. Must be called before
92-
* passing a custom implementation into configuration.
93-
* @param backend Implementation to initialize.
91+
* Initializes an instance of LDPersistence with default function pointers,
92+
* additionally setting UserData to NULL.
93+
*
94+
* This must be called after declaring the struct, but before setting any
95+
* custom function pointers.
96+
*
97+
* Example:
98+
* @code
99+
* struct LDPersistence customPersistence;
100+
* LDPersistence_Init(&customPersistence);
101+
*
102+
* customPersistence.SetFn = my_set_function;
103+
* customPersistence.RemoveFn = my_remove_function;
104+
* customPersistence.ReadFn = my_read_function;
105+
* customPersistence.FreeFn = my_free_read_function;
106+
* customPersistence.UserData = my_user_data_ptr;
107+
* @endcode
108+
*
109+
* @param LDPersistence to initialize.
94110
*/
95111
LD_EXPORT(void)
96112
LDPersistence_Init(struct LDPersistence* implementation);

0 commit comments

Comments
 (0)