Skip to content

Commit

Permalink
Version 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jgraha8 committed Feb 15, 2019
1 parent 0790398 commit 50f4d12
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 48 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ libautoptr_la_SOURCES =
#
# version-info current:revision:age
#
libautoptr_la_LDFLAGS=-rpath '$(libdir)' -version-info 1:1:1
libautoptr_la_LDFLAGS=-rpath '$(libdir)' -version-info 2:2:2
libautoptr_la_LIBADD = $(SUBLIBS)

pkgincludedir = ${includedir}
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ data structure. An example usage is

struct my_struct {
struct autoptr __autoptr; // Treating as a "private" member
int data;
...
};

Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

dnl AC_PREREQ([2.59])
AC_INIT([libautoptr], [0.1.0], [jgraham@compukix.net])
AC_INIT([libautoptr], [0.2.0], [jgraham@compukix.net])

AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_HEADERS([config.h])
Expand Down Expand Up @@ -36,7 +36,7 @@ dnl Check if Libtool is present
dnl Libtool is used for building share libraries
AC_PROG_LIBTOOL

# Checks for header files.
# Checks for header files.i
AC_CHECK_HEADERS([ \
assert.h \
pthread.h \
Expand Down
2 changes: 1 addition & 1 deletion doc/doxygen/doxygen.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "libautoptr"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 0.0
PROJECT_NUMBER = 0.2.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
32 changes: 16 additions & 16 deletions tests/test_autoptr1.c
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
#include <assert.h>
#include <stdlib.h>

#include <libautoptr/autoptr.h>
#include "test_common.h"
#include <libautoptr/autoptr.h>

int main(int argc, char **argv)
{
struct test t;
struct test *p = NULL;
test_ctor(&t);
p = autoptr_bind(&t);
struct test t;
struct test *p = NULL;

test_ctor(&t);
p = autoptr_bind(&t);

assert( ! autoptr_destroy_ok(&t) );
assert(!autoptr_destroy_ok(&t));

// Release ownership of primary test object
autoptr_release(&t);
// Release ownership of primary test object
autoptr_release(&t);

// The test object should be destroyable (i.e., single owner)
assert( autoptr_destroy_ok(&t) );
// The test object should be destroyable (i.e., single owner)
assert(autoptr_destroy_ok(&t));

autoptr_unbind((void **)&p);
assert( p == NULL );
autoptr_unbind((void **)&p);
assert(p == NULL);

// Ensure that destructor callback was called
assert(!test_initd);
// Ensure that destructor callback was called
assert(!test_initd);

return 0;
return 0;
}
52 changes: 26 additions & 26 deletions tests/test_autoptr2.c
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
#include <assert.h>
#include <stdlib.h>

#include <libautoptr/autoptr.h>
#include "test_common.h"
#include <libautoptr/autoptr.h>

int main(int argc, char **argv)
{
struct test *t = test_valloc(3);
struct test *p0 = autoptr_bind(&t[0]);
struct test *p1 = autoptr_bind(&t[1]);
struct test *p2 = autoptr_bind(&t[2]);
assert( ! autoptr_destroy_ok(t) );

// Release ownership of primary test object
autoptr_release(t);

autoptr_unbind((void **)&p0);
assert( p0 == NULL );
assert(test_initd);

autoptr_unbind((void **)&p1);
assert( p1 == NULL );
assert(test_initd);

autoptr_unbind((void **)&p2);
assert( p2 == NULL );
// Ensure that destructor callback was called
assert(!test_initd);

return 0;
struct test *t = test_valloc(3);
struct test *p0 = autoptr_bind(&t[0]);
struct test *p1 = autoptr_bind(&t[1]);
struct test *p2 = autoptr_bind(&t[2]);

assert(!autoptr_destroy_ok(t));

// Release ownership of primary test object
autoptr_release(t);

autoptr_unbind((void **)&p0);
assert(p0 == NULL);
assert(test_initd);

autoptr_unbind((void **)&p1);
assert(p1 == NULL);
assert(test_initd);

autoptr_unbind((void **)&p2);
assert(p2 == NULL);

// Ensure that destructor callback was called
assert(!test_initd);

return 0;
}
4 changes: 2 additions & 2 deletions tests/test_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ static int test_initd = 0;

struct test {
struct autoptr __autoptr;
int data;
int data;
};

static void test_dtor(struct test *t);
Expand All @@ -18,7 +18,7 @@ static void test_ctor(struct test *t)
autoptr_ctor(t, sizeof(*t), (void (*)(void *))test_dtor);
++test_initd;

t->data = 42;
t->data = 42;
}

static void test_dtor(struct test *t)
Expand Down

0 comments on commit 50f4d12

Please sign in to comment.