Compare commits

...

6 Commits

Author SHA1 Message Date
787611dbd4 autotools configure updates; 2025-03-10 23:54:00 +02:00
a5fdc8e119 gitignore update for debian dir; 2025-03-06 01:10:27 +02:00
fecbd1286c Debian files fixed, package version bump-up; 2025-03-05 14:42:55 +02:00
Alexander Vdolainen
9de915d72f merge with 1.3.3; 2019-11-12 14:20:38 +02:00
Alexander Vdolainen
e78adae9d6 snadd() function; 2019-11-12 14:18:27 +02:00
Alexander Vdolainen
f5c0db55ac minor comments; 2019-11-12 14:17:16 +02:00
6 changed files with 61 additions and 28 deletions

View File

@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(libsexpr, m4_esyscmd([tr -d '\n' < VERSION]))
AC_INIT([libsexpr],[m4_esyscmd(tr -d '\n' < VERSION)])
AC_CONFIG_HEADERS([config.h])
@ -30,8 +30,9 @@ AS_IF([test "x$enable_faststack_alloc" = "xyes"], [
AC_DEFINE([USE_FASTSTACK_ALLOC], 1, [using faststack allocation within parser])
])
AC_OUTPUT([
AC_CONFIG_FILES([
Makefile
lib/libsexpr.pc
lib/Makefile
include/Makefile])
AC_OUTPUT

1
debian/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.debhelper

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
libsexpr (1.3.3) stable; urgency=medium
* Release 1.3.3 More helper functions to easy works on a simple S expressions
* Updates to the new and uptodate libraries
-- Alexander Vdolainen <alex@vapaa.xyz> Mon, 3 Jun 2019 23:34:56 +0100
libsexpr (1.3.1) stable; urgency=medium
* Release 1.3.1 Added helper functions to operate with S-expressions

35
debian/copyright vendored
View File

@ -1,20 +1,26 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: libsexpr
Source: <url://example.com>
Source: <https://vapaa.work/public/libsexpr>
Files: *
Copyright: <years> <put author's name and email here>
<years> <likewise for another author>
License: <special license>
<Put the license of the package here indented by 1 space>
<This follows the format of Description: lines in control file>
.
<Including paragraphs>
Copyright: 2003 - 2006 Matthew Sottile <mjsottile@gmail.com>
2010 - 2014 Alexander Vdolainen <alex@vapaa.xyz>
License: LGPL-2
Additionally, this library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, U SA
# If you want to use GPL v2 or later for the /debian/* files use
# the following clauses, or change it to suit. Delete these two lines
Files: debian/*
Copyright: 2014 Alexander Vdolainen <vdo@daze>
Copyright: 2014, 2025 Alexander Vdolainen <alex@vapaa.xyz>
License: GPL-2+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -31,8 +37,3 @@ License: GPL-2+
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
# Please avoid to pick license terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.

View File

@ -78,14 +78,14 @@ extern "C" {
* Set the growth size. Values less than one are ignored.
*/
void sgrowsize(size_t s);
/**
* Allocate a new CSTRING of the given size.
* A NULL return value indicates that something went wrong and that
* sexp_errno should be checked for the cause.
*/
CSTRING *snew(size_t s);
/**
* Concatenate the second argument to the CSTRING passed in the first.
* The second argument must be a pointer to a null terminated string.
@ -96,7 +96,18 @@ extern "C" {
* leak if an error condition occurs.
*/
CSTRING *sadd(CSTRING *s, char *a);
/**
* Concatenate the len bytes of the second argument to the CSTRING
* passed in the first.
* A NULL return value indicates that something went wrong and that
* sexp_errno should be checked for the cause. The contents of s are
* left alone. As such, the caller should check the pointer returned
* before overwriting the value of s, as this may result in a memory
* leak if an error condition occurs.
*/
CSTRING *snadd(CSTRING *s, char *a, size_t len);
/**
* Append a character to the end of the CSTRING.
* A NULL return value indicates that something went wrong and that
@ -106,7 +117,7 @@ extern "C" {
* leak if an error condition occurs.
*/
CSTRING *saddch(CSTRING *s, char a);
/**
* Trim the allocated memory to precisely the string length plus one char
* to hold the null terminator

View File

@ -86,7 +86,18 @@ CSTRING *snew(size_t s) {
return cs;
}
CSTRING *sadd(CSTRING *s, char *a) {
CSTRING *sadd(CSTRING *s, char *a)
{
size_t len = strlen(a);
if(!s) return NULL;
if(!a || !len) return s;
return snadd(s, a, len);
}
CSTRING *snadd(CSTRING *s, char *a, size_t len)
{
size_t alen;
char *newbase;
@ -100,7 +111,7 @@ CSTRING *sadd(CSTRING *s, char *a) {
return s;
}
alen = strlen(a);
alen = len;
if (s->curlen + alen >= s->len) {
#ifdef __cplusplus
@ -112,12 +123,12 @@ CSTRING *sadd(CSTRING *s, char *a) {
s->len+cstring_growsize+alen,
s->len);
#endif
/* do NOT destroy s anymore. if realloc fails, the original data is
still valid, so just report the error to sexp_errno and return NULL.
*/
if (newbase == NULL) {
sexp_errno = SEXP_ERR_MEMORY;
sexp_errno = SEXP_ERR_MEMORY;
return NULL;
}
@ -125,9 +136,10 @@ CSTRING *sadd(CSTRING *s, char *a) {
s->base = newbase;
}
memcpy(&s->base[s->curlen],a,alen);
memcpy(&s->base[s->curlen], a, alen);
s->curlen += alen;
s->base[s->curlen] = 0;
return s;
}