renamed the uuid to luid
uuid's are somewhat standardized, we use our uid's slightly differently, so change the name not to be confused with standards. * Small fix for luid generation * build a 'luidgen' tool which will be used by the interface gen later * add emacs vars * include the luidgen tool in automake
This commit is contained in:
parent
163ba179ed
commit
9826fd180d
11 changed files with 310 additions and 188 deletions
|
|
@ -38,6 +38,9 @@ include $(top_srcdir)/src/common/Makefile.am
|
||||||
include $(top_srcdir)/src/lib/Makefile.am
|
include $(top_srcdir)/src/lib/Makefile.am
|
||||||
include $(top_srcdir)/src/backend/Makefile.am
|
include $(top_srcdir)/src/backend/Makefile.am
|
||||||
|
|
||||||
|
# tools
|
||||||
|
include $(top_srcdir)/src/tool/Makefile.am
|
||||||
|
|
||||||
# gui
|
# gui
|
||||||
include $(top_srcdir)/src/gui/Makefile.am
|
include $(top_srcdir)/src/gui/Makefile.am
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ liblumi_a_SOURCES = \
|
||||||
$(liblumi_a_srcdir)/rwlock.c \
|
$(liblumi_a_srcdir)/rwlock.c \
|
||||||
$(liblumi_a_srcdir)/condition.c \
|
$(liblumi_a_srcdir)/condition.c \
|
||||||
$(liblumi_a_srcdir)/references.c \
|
$(liblumi_a_srcdir)/references.c \
|
||||||
$(liblumi_a_srcdir)/uuid.c \
|
$(liblumi_a_srcdir)/luid.c \
|
||||||
$(liblumi_a_srcdir)/safeclib.c \
|
$(liblumi_a_srcdir)/safeclib.c \
|
||||||
$(liblumi_a_srcdir)/cuckoo.c \
|
$(liblumi_a_srcdir)/cuckoo.c \
|
||||||
$(liblumi_a_srcdir)/mrucache.c \
|
$(liblumi_a_srcdir)/mrucache.c \
|
||||||
|
|
@ -43,7 +43,7 @@ noinst_HEADERS += \
|
||||||
$(liblumi_a_srcdir)/rwlock.h \
|
$(liblumi_a_srcdir)/rwlock.h \
|
||||||
$(liblumi_a_srcdir)/condition.h \
|
$(liblumi_a_srcdir)/condition.h \
|
||||||
$(liblumi_a_srcdir)/references.h \
|
$(liblumi_a_srcdir)/references.h \
|
||||||
$(liblumi_a_srcdir)/uuid.h \
|
$(liblumi_a_srcdir)/luid.h \
|
||||||
$(liblumi_a_srcdir)/safeclib.h \
|
$(liblumi_a_srcdir)/safeclib.h \
|
||||||
$(liblumi_a_srcdir)/cuckoo.h \
|
$(liblumi_a_srcdir)/cuckoo.h \
|
||||||
$(liblumi_a_srcdir)/mrucache.h \
|
$(liblumi_a_srcdir)/mrucache.h \
|
||||||
|
|
|
||||||
113
src/lib/luid.c
Normal file
113
src/lib/luid.c
Normal file
|
|
@ -0,0 +1,113 @@
|
||||||
|
/*
|
||||||
|
luid - Lumiera unique identifiers
|
||||||
|
|
||||||
|
Copyright (C) Lumiera.org
|
||||||
|
2008, Christian Thaeter <ct@pipapo.org>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program 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 General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "lib/luid.h"
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
lumiera_uid_set_ptr (lumiera_uid* luid, void* ptr)
|
||||||
|
{
|
||||||
|
memset (luid, 0, 16);
|
||||||
|
*(void**)luid = ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void*
|
||||||
|
lumiera_uid_ptr_get (lumiera_uid* luid)
|
||||||
|
{
|
||||||
|
return *(void**)luid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
lumiera_uid_gen (lumiera_uid* luid)
|
||||||
|
{
|
||||||
|
static int fd = -2;
|
||||||
|
if (!luid)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (fd == -2)
|
||||||
|
{
|
||||||
|
fd = open ("/dev/urandom", O_RDONLY);
|
||||||
|
/* on linux /dev/random would be way to slow for our purpose, so we comment that out for now.
|
||||||
|
other unixiods offer a /dev/random which has the same semantics as linux /dev/urandom has,
|
||||||
|
configuration should do this right some day.
|
||||||
|
if (fd == -1)
|
||||||
|
fd = open ("/dev/random", O_RDONLY);
|
||||||
|
*/
|
||||||
|
if (fd >= 0)
|
||||||
|
fcntl (fd, F_SETFD, FD_CLOEXEC);
|
||||||
|
else
|
||||||
|
srand (getpid () + time (NULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (fd < 0)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 16; ++i)
|
||||||
|
((unsigned char*)luid)[i] = (unsigned char)(rand()>>7);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (read (fd, luid, 16) < 16)
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* we identify generic pointers by having some zeros in the luid,
|
||||||
|
* this happens very unlikely to be in a random luid, just regenerate it then */
|
||||||
|
while (!*(((intptr_t*)luid)+1));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
lumiera_uid_copy (lumiera_uid* dest, lumiera_uid* src)
|
||||||
|
{
|
||||||
|
memcpy (dest, src, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
lumiera_uid_eq (lumiera_uid* luida, lumiera_uid* luidb)
|
||||||
|
{
|
||||||
|
return !memcmp (luida, luidb, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
lumiera_uid_hash (lumiera_uid* luid)
|
||||||
|
{
|
||||||
|
return *(size_t*)luid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Local Variables:
|
||||||
|
// mode: C
|
||||||
|
// c-file-style: "gnu"
|
||||||
|
// indent-tabs-mode: nil
|
||||||
|
// End:
|
||||||
|
*/
|
||||||
81
src/lib/luid.h
Normal file
81
src/lib/luid.h
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
/*
|
||||||
|
luid - Lumiera unique identifiers
|
||||||
|
|
||||||
|
Copyright (C) Lumiera.org
|
||||||
|
2008, Christian Thaeter <ct@pipapo.org>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program 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 General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
#ifndef LUMIERA_LUID_H
|
||||||
|
#define LUMIERA_LUID_H
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Lumiera unique identifiers are 128 byte random value. Unlike standard uuid's we
|
||||||
|
* don't tag a version within them and we may store generic pointers in the space
|
||||||
|
* occupied by an luid.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef unsigned char lumiera_uid[16];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve a generic pointer stored in a luid
|
||||||
|
*/
|
||||||
|
void*
|
||||||
|
lumiera_uid_ptr_get (lumiera_uid* luid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a new luid
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
lumiera_uid_gen (lumiera_uid* luid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a generic pointer in a luid
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
lumiera_uid_set_ptr (lumiera_uid* luid, void* ptr);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy an luid
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
lumiera_uid_copy (lumiera_uid* dest, lumiera_uid* src);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test 2 luid's for equality
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
lumiera_uid_eq (lumiera_uid* luida, lumiera_uid* luidb);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a hashsum over an luid
|
||||||
|
*/
|
||||||
|
size_t
|
||||||
|
lumiera_uid_hash (lumiera_uid* luid);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
// Local Variables:
|
||||||
|
// mode: C
|
||||||
|
// c-file-style: "gnu"
|
||||||
|
// indent-tabs-mode: nil
|
||||||
|
// End:
|
||||||
|
*/
|
||||||
|
|
@ -1,95 +0,0 @@
|
||||||
/*
|
|
||||||
uuid - Universal unique identifiers
|
|
||||||
|
|
||||||
Copyright (C) CinelerraCV
|
|
||||||
2008, Christian Thaeter <ct@pipapo.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License as
|
|
||||||
published by the Free Software Foundation; either version 2 of the
|
|
||||||
License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program 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 General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "lib/uuid.h"
|
|
||||||
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
void
|
|
||||||
lumiera_uuid_set_ptr (lumiera_uuid* uuid, void* ptr)
|
|
||||||
{
|
|
||||||
memset (uuid, 0, 16);
|
|
||||||
*(void**)uuid = ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void*
|
|
||||||
lumiera_uuid_ptr_get (lumiera_uuid* uuid)
|
|
||||||
{
|
|
||||||
return *(void**)uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
lumiera_uuid_gen (lumiera_uuid* uuid)
|
|
||||||
{
|
|
||||||
static int fd = -2;
|
|
||||||
if (!uuid)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (fd == -2)
|
|
||||||
{
|
|
||||||
fd = open ("/dev/urandom", O_RDONLY);
|
|
||||||
if (fd == -1)
|
|
||||||
fd = open ("/dev/random", O_RDONLY);
|
|
||||||
if (fd >= 0)
|
|
||||||
fcntl (fd, F_SETFD, FD_CLOEXEC);
|
|
||||||
else
|
|
||||||
srand (getpid () + time (NULL));
|
|
||||||
}
|
|
||||||
if (fd < 0)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < 16; ++i)
|
|
||||||
((unsigned char*)uuid)[i] = (unsigned char)(rand()>>7);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (read (fd, uuid, 16) < 0)
|
|
||||||
abort ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
lumiera_uuid_copy (lumiera_uuid* dest, lumiera_uuid* src)
|
|
||||||
{
|
|
||||||
memcpy (dest, src, 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
lumiera_uuid_eq (lumiera_uuid* uuida, lumiera_uuid* uuidb)
|
|
||||||
{
|
|
||||||
return !memcmp (uuida, uuidb, 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t
|
|
||||||
lumiera_uuid_hash (lumiera_uuid* uuid)
|
|
||||||
{
|
|
||||||
return *(size_t*)uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,67 +0,0 @@
|
||||||
/*
|
|
||||||
uuid - Universal unique identifiers
|
|
||||||
|
|
||||||
Copyright (C) CinelerraCV
|
|
||||||
2008, Christian Thaeter <ct@pipapo.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU General Public License as
|
|
||||||
published by the Free Software Foundation; either version 2 of the
|
|
||||||
License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program 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 General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
#ifndef LUMIERA_UUID_H
|
|
||||||
#define LUMIERA_UUID_H
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
typedef unsigned char lumiera_uuid[16];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve a generic pointer stored in a uuid
|
|
||||||
*/
|
|
||||||
void*
|
|
||||||
lumiera_uuid_ptr_get (lumiera_uuid* uuid);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate a new uuid
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
lumiera_uuid_gen (lumiera_uuid* uuid);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store a generic pointer in a uuid
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
lumiera_uuid_set_ptr (lumiera_uuid* uuid, void* ptr);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy an uuid
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
lumiera_uuid_copy (lumiera_uuid* dest, lumiera_uuid* src);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test 2 uuid's for equality
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
lumiera_uuid_eq (lumiera_uuid* uuida, lumiera_uuid* uuidb);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate a hashsum over an uuid
|
|
||||||
*/
|
|
||||||
size_t
|
|
||||||
lumiera_uuid_hash (lumiera_uuid* uuid);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
28
src/tool/Makefile.am
Normal file
28
src/tool/Makefile.am
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Copyright (C) Lumiera.org
|
||||||
|
# 2008 Christian Thaeter <ct@pipapo.org>
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License as
|
||||||
|
# published by the Free Software Foundation; either version 2 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program 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 General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
lumitool_srcdir = $(top_srcdir)/src/tool
|
||||||
|
|
||||||
|
noinst_PROGRAMS += luidgen
|
||||||
|
|
||||||
|
luidgen_CFLAGS = $(CFLAGS) -std=gnu99 -Wall -Werror
|
||||||
|
luidgen_CPPFLAGS = -I$(top_srcdir)/src/
|
||||||
|
luidgen_SOURCES = \
|
||||||
|
$(lumitool_srcdir)/luidgen.c
|
||||||
|
|
||||||
|
luidgen_LDADD = liblumi.a
|
||||||
|
|
||||||
51
src/tool/luidgen.c
Normal file
51
src/tool/luidgen.c
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
luidgen.c - generate a lumiera uuid
|
||||||
|
|
||||||
|
Copyright (C) Lumiera.org
|
||||||
|
2008 Christian Thaeter <ct@pipapo.org>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program 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 General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "lib/luid.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Generate amd print a Lumiera uid as octal escaped string
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char** argv)
|
||||||
|
{
|
||||||
|
lumiera_uid luid;
|
||||||
|
lumiera_uid_gen (&luid);
|
||||||
|
|
||||||
|
printf ("\"");
|
||||||
|
for (int i = 0; i < 16; ++i)
|
||||||
|
printf ("\\%.3hho", *(((char*)&luid)+i));
|
||||||
|
printf ("\"\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Local Variables:
|
||||||
|
// mode: C
|
||||||
|
// c-file-style: "gnu"
|
||||||
|
// indent-tabs-mode: nil
|
||||||
|
// End:
|
||||||
|
*/
|
||||||
|
|
@ -39,12 +39,12 @@ test_llist_LDADD = liblumi.a -lnobugmt -lpthread -ldl -lm
|
||||||
check_PROGRAMS += test-safeclib
|
check_PROGRAMS += test-safeclib
|
||||||
test_safeclib_SOURCES = $(tests_srcdir)/library/test-safeclib.c
|
test_safeclib_SOURCES = $(tests_srcdir)/library/test-safeclib.c
|
||||||
test_safeclib_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror -I$(top_srcdir)/src/
|
test_safeclib_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror -I$(top_srcdir)/src/
|
||||||
test_safeclib_LDADD = $(builddir)/liblumi.a -lnobugmt -lpthread -ldl -lm
|
test_safeclib_LDADD = liblumi.a -lnobugmt -lpthread -ldl -lm
|
||||||
|
|
||||||
check_PROGRAMS += test-uuid
|
check_PROGRAMS += test-luid
|
||||||
test_uuid_SOURCES = $(tests_srcdir)/library/test-uuid.c
|
test_luid_SOURCES = $(tests_srcdir)/library/test-luid.c
|
||||||
test_uuid_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror -I$(top_srcdir)/src/
|
test_luid_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror -I$(top_srcdir)/src/
|
||||||
test_uuid_LDADD = $(builddir)/liblumi.a -lnobugmt -lpthread -ldl -lm
|
test_luid_LDADD = liblumi.a -lnobugmt -lpthread -ldl -lm
|
||||||
|
|
||||||
check_PROGRAMS += test-references
|
check_PROGRAMS += test-references
|
||||||
test_references_SOURCES = $(tests_srcdir)/library/test-references.c
|
test_references_SOURCES = $(tests_srcdir)/library/test-references.c
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
test-uuid.c - test the uuid lib
|
test-luid.c - test the luid lib
|
||||||
|
|
||||||
Copyright (C) CinelerraCV
|
Copyright (C) Lumiera.org
|
||||||
2007, Christian Thaeter <ct@pipapo.org>
|
2007, 2008 Christian Thaeter <ct@pipapo.org>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License as
|
modify it under the terms of the GNU General Public License as
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
//#include <stdio.h>
|
//#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
#include "lib/uuid.h"
|
#include "lib/luid.h"
|
||||||
|
|
||||||
#include <nobug.h>
|
#include <nobug.h>
|
||||||
|
|
||||||
|
|
@ -39,35 +39,43 @@ main (int argc, char** argv)
|
||||||
|
|
||||||
if (!strcmp(argv[1], "uuidgen_2"))
|
if (!strcmp(argv[1], "uuidgen_2"))
|
||||||
{
|
{
|
||||||
lumiera_uuid uuid1;
|
lumiera_uid luid1;
|
||||||
lumiera_uuid uuid2;
|
lumiera_uid luid2;
|
||||||
|
|
||||||
lumiera_uuid_gen (&uuid1);
|
lumiera_uid_gen (&luid1);
|
||||||
lumiera_uuid_gen (&uuid2);
|
lumiera_uid_gen (&luid2);
|
||||||
|
|
||||||
printf ("%d\n", lumiera_uuid_eq (&uuid2, &uuid1));
|
printf ("%d\n", lumiera_uid_eq (&luid2, &luid1));
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[1], "uuidgen_copy"))
|
else if (!strcmp(argv[1], "uuidgen_copy"))
|
||||||
{
|
{
|
||||||
lumiera_uuid uuid1;
|
lumiera_uid luid1;
|
||||||
lumiera_uuid uuid2;
|
lumiera_uid luid2;
|
||||||
|
|
||||||
lumiera_uuid_gen (&uuid1);
|
lumiera_uid_gen (&luid1);
|
||||||
|
|
||||||
lumiera_uuid_copy (&uuid2, &uuid1);
|
lumiera_uid_copy (&luid2, &luid1);
|
||||||
|
|
||||||
printf ("%d\n", lumiera_uuid_eq (&uuid2, &uuid1));
|
printf ("%d\n", lumiera_uid_eq (&luid2, &luid1));
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[1], "ptrs"))
|
else if (!strcmp(argv[1], "ptrs"))
|
||||||
{
|
{
|
||||||
lumiera_uuid uuid;
|
lumiera_uid luid;
|
||||||
|
|
||||||
lumiera_uuid_set_ptr (&uuid, &uuid);
|
lumiera_uid_set_ptr (&luid, &luid);
|
||||||
|
|
||||||
printf ("%d\n", lumiera_uuid_ptr_get (&uuid) == &uuid);
|
printf ("%d\n", lumiera_uid_ptr_get (&luid) == &luid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Local Variables:
|
||||||
|
// mode: C
|
||||||
|
// c-file-style: "gnu"
|
||||||
|
// indent-tabs-mode: nil
|
||||||
|
// End:
|
||||||
|
*/
|
||||||
Loading…
Reference in a new issue