Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3201 from PhilippGackstatter/remove-kdbproposal
Browse files Browse the repository at this point in the history
Remove kdbproposal
  • Loading branch information
mpranj authored Nov 15, 2020
2 parents f370cc5 + dbbd51b commit 6bb3e2c
Show file tree
Hide file tree
Showing 26 changed files with 149 additions and 349 deletions.
13 changes: 1 addition & 12 deletions doc/man/man7/elektra-libs.7
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "ELEKTRA\-LIBS" "7" "August 2019" "" ""
.TH "ELEKTRA\-LIBS" "7" "November 2019" "" ""
.
.SH "NAME"
\fBelektra\-libs\fR \- libs overview
Expand Down Expand Up @@ -98,17 +98,6 @@ libelektra\-plugin\.so
.P
\fBlibplugin \fIplugin/\fR\fR contains \fBelektraPlugin*\fR symbols to be used by plugins\.
.
.SS "Libproposal"
.
.nf

libelektra\-proposal\.so
.
.fi
.
.P
\fBlibproposal \fIproposal/\fR\fR contains functions that are proposed for libcore\. Depends on internals of libcore and as such must always fit to the exact same version\.
.
.SS "Libmeta"
.
.nf
Expand Down
6 changes: 3 additions & 3 deletions doc/news/_preparation_next_release.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ The text below summarizes updates to the [C (and C++)-based libraries](https://w
- <<TODO>>
- <<TODO>>

### <<Library3>>
### Proposal

- <<TODO>>
- <<TODO>>
- Removed `elektraKeyGetMetaKeySet` and moved `keySetStringF` to the hosts plugin. _(Philipp Gackstatter)_
- Removed `ksPopAtCursor`. _(Philipp Gackstatter)_
- <<TODO>>

## Bindings
Expand Down
15 changes: 0 additions & 15 deletions src/include/kdbinternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,4 @@
#include <kdbprivate.h>
#include <kdbproposal.h>

#ifdef __cplusplus
namespace ckdb
{
extern "C" {
#endif

// can be made simply without Elektra's internals, so better keep it as
// extension.
ssize_t keySetStringF (Key * key, const char * format, ...);

#ifdef __cplusplus
}
}
#endif

#endif
3 changes: 0 additions & 3 deletions src/include/kdbproposal.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ extern "C" {
// this might become the new keySetName
ssize_t elektraKeySetName (Key * key, const char * newName, elektraKeyFlags options);

KeySet * elektraKeyGetMetaKeySet (const Key * key);

Key * ksPopAtCursor (KeySet * ks, elektraCursor c);

#ifdef __cplusplus
}
Expand Down
1 change: 0 additions & 1 deletion src/libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ set (
loader
ease
globbing
proposal
meta
plugin
pluginprocess
Expand Down
9 changes: 0 additions & 9 deletions src/libs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,6 @@ libelektra-plugin.so

**[libplugin](plugin/)** contains `elektraPlugin*` symbols to be used by plugins.

### Libproposal

```
libelektra-proposal.so
```

**[libproposal](proposal/)** contains functions that are proposed for libcore. Depends on internals of libcore and as
such must always fit to the exact same version.

### Libmeta

```
Expand Down
2 changes: 2 additions & 0 deletions src/libs/ease/symbols.map
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ libelektra_0.9 {
elektraKeyToUnsignedLong;
elektraKeyToUnsignedLongLong;
elektraKeyToUnsignedShort;

elektraKsToMemArray;
};

libelektraprivate_1.0 {
Expand Down
20 changes: 19 additions & 1 deletion src/libs/elektra/proposal.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,25 @@
#include <kdbprivate.h>

/**
* @copydoc ksPopAtCursor
* @brief Pop key at given cursor position
*
* @param ks the keyset to pop key from
* @param c where to pop
*
* The internal cursor will be rewinded using ksRewind(). You can use
* ksGetCursor() and ksSetCursor() jump back to the previous position.
* e.g. to pop at current position within ksNext() loop:
* @code
* cursor_t c = ksGetCursor(ks);
* keyDel (elektraKsPopAtCursor(ks, c));
* ksSetCursor(ks, c);
* ksPrev(ks); // to have correct key after next ksNext()
* @endcode
*
* @warning do not use, will be superseded by external iterator API
*
* @return the popped key
* @retval 0 if ks is 0
*/
Key * elektraKsPopAtCursor (KeySet * ks, elektraCursor pos)
{
Expand Down
2 changes: 1 addition & 1 deletion src/libs/meta/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
file (GLOB SOURCES *.c)
add_lib (meta SOURCES ${SOURCES} LINK_ELEKTRA elektra-ease elektra-proposal)
add_lib (meta SOURCES ${SOURCES} LINK_ELEKTRA elektra-ease)
2 changes: 0 additions & 2 deletions src/libs/proposal/CMakeLists.txt

This file was deleted.

119 changes: 0 additions & 119 deletions src/libs/proposal/proposal.c

This file was deleted.

10 changes: 0 additions & 10 deletions src/libs/proposal/symbols.map

This file was deleted.

2 changes: 1 addition & 1 deletion src/plugins/augeas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ add_plugin (
ADD_TEST INSTALL_TEST_DATA
INCLUDE_DIRECTORIES ${AUGEAS_PLUGIN_INCLUDE_DIRS}
COMPILE_DEFINITIONS "${LIBAUGEAS_COMPILE_DEFINITIONS}"
LINK_ELEKTRA elektra-meta elektra-proposal
LINK_ELEKTRA elektra-meta
LINK_LIBRARIES ${AUGEAS_PLUGIN_LIBRARIES}
TEST_ENVIRONMENT "ASAN_OPTIONS=detect_container_overflow=0")
10 changes: 5 additions & 5 deletions src/plugins/augeas/testmod_augeas.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <string.h>
#endif

#include <kdbproposal.h>
#include <kdbprivate.h>

#include <tests_plugin.h>

Expand Down Expand Up @@ -128,22 +128,22 @@ static void test_hostLensDelete (char * sourceFile, char * compFile)

Key * key = ksLookupByName (ks, "user/tests/augeas-hosts/1", 0);
exit_if_fail (key, "localhost not found");
ksPopAtCursor (ks, ksGetCursor (ks));
elektraKsPopAtCursor (ks, ksGetCursor (ks));
keyDel (key);

key = ksLookupByName (ks, "user/tests/augeas-hosts/1/ipaddr", 0);
exit_if_fail (key, "ip address of localhost not found");
ksPopAtCursor (ks, ksGetCursor (ks));
elektraKsPopAtCursor (ks, ksGetCursor (ks));
keyDel (key);

key = ksLookupByName (ks, "user/tests/augeas-hosts/1/canonical", 0);
exit_if_fail (key, "canonical of localhost not found");
ksPopAtCursor (ks, ksGetCursor (ks));
elektraKsPopAtCursor (ks, ksGetCursor (ks));
keyDel (key);

key = ksLookupByName (ks, "user/tests/augeas-hosts/1/#comment", 0);
exit_if_fail (key, "comment of localhost not found");
ksPopAtCursor (ks, ksGetCursor (ks));
elektraKsPopAtCursor (ks, ksGetCursor (ks));
keyDel (key);

keySetString (parentKey, elektraFilename ());
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/hosts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include (LibAddMacros)
add_plugin (
hosts
SOURCES hosts.h hosts-get.c hosts-set.c keymetaformatting.h keymetaformatting.c
LINK_ELEKTRA elektra-ease elektra-proposal elektra-meta
LINK_ELEKTRA elektra-ease elektra-meta
ADD_TEST TEST_README
TEST_REQUIRED_PLUGINS network
INSTALL_TEST_DATA)
3 changes: 1 addition & 2 deletions src/plugins/hosts/hosts-set.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static const char * getMetaValue (Key * key, const char * metaName)
static void writeLineComments (Key * key, FILE * fp)
{
// TODO: this is really inefficient
KeySet * metaKeys = elektraKeyGetMetaKeySet (key);
KeySet * metaKeys = keyMeta (key);
Key * commentParent = keyNew ("comment", KEY_META_NAME, KEY_END);
KeySet * comments = elektraArrayGet (commentParent, metaKeys);
keyDel (commentParent);
Expand All @@ -85,7 +85,6 @@ static void writeLineComments (Key * key, FILE * fp)
}
}

ksDel (metaKeys);
ksDel (comments);
}

Expand Down
36 changes: 36 additions & 0 deletions src/plugins/hosts/keymetaformatting.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,42 @@
#include <kdbinternal.h>
#include <string.h>

/**
* @brief Set a formatted string
*
* @param key the key to set the string value
* @param format NULL-terminated text format string
* @param ... more arguments
*
* @return the size of the string as set (with including 0)
*/
ssize_t keySetStringF (Key * key, const char * format, ...)
{
va_list arg_list;

keySetMeta (key, "binary", 0);

va_start (arg_list, format);
char * p = elektraVFormat (format, arg_list);
va_end (arg_list);

if (!p)
{
return -1;
}

if (key->data.c && !test_bit (key->flags, KEY_FLAG_MMAP_DATA))
{
elektraFree (key->data.c);
}

key->data.c = p;
key->dataSize = elektraStrLen (key->data.c);
set_bit (key->flags, KEY_FLAG_SYNC);

return key->dataSize;
}

static void elektraAddCommentInfo (KeySet * comments, Key * commentBase, size_t spaces, const char * commentStart, const char * comment)
{
keySetString (commentBase, comment);
Expand Down
1 change: 1 addition & 0 deletions src/plugins/hosts/keymetaformatting.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
void elektraAddLineComment (KeySet * comments, size_t spaces, const char * commentStart, const char * comment);
void elektraAddInlineComment (KeySet * comments, size_t spaces, const char * commentStart, const char * comment);
size_t elektraCountStartSpaces (const char * line);
ssize_t keySetStringF (Key * key, const char * format, ...);

#endif /* KEYMETAFORMATTING_H_ */
Loading

0 comments on commit 6bb3e2c

Please sign in to comment.