<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems (2011-12-12)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
<font color='#bb2222'><strong>sh</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-12-12 Sebastian Huber <sebastian.huber@embedded-brains.de>
* score/src/wkstringduplicate.c: New file.
* score/Makefile.am: Reflect change above.
* score/include/rtems/score/wkspace.h: Declare
_Workspace_String_duplicate().
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/ChangeLog.diff?r1=text&tr1=1.3085&r2=text&tr2=1.3086&diff_format=h">M</a></td><td width='1%'>1.3086</td><td width='100%'>cpukit/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/Makefile.am.diff?r1=text&tr1=1.112&r2=text&tr2=1.113&diff_format=h">M</a></td><td width='1%'>1.113</td><td width='100%'>cpukit/score/Makefile.am</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/include/rtems/score/wkspace.h.diff?r1=text&tr1=1.33&r2=text&tr2=1.34&diff_format=h">M</a></td><td width='1%'>1.34</td><td width='100%'>cpukit/score/include/rtems/score/wkspace.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/src/wkstringduplicate.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">cpukit/score/src/wkstringduplicate.c</font></td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/cpukit/ChangeLog:1.3085 rtems/cpukit/ChangeLog:1.3086
--- rtems/cpukit/ChangeLog:1.3085 Fri Dec 9 23:34:14 2011
+++ rtems/cpukit/ChangeLog Mon Dec 12 09:17:32 2011
</font><font color='#997700'>@@ -1,3 +1,10 @@
</font><font color='#000088'>+2011-12-12 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * score/src/wkstringduplicate.c: New file.
+ * score/Makefile.am: Reflect change above.
+ * score/include/rtems/score/wkspace.h: Declare
+ _Workspace_String_duplicate().
+
</font> 2011-12-10 Ralf Corsépius <ralf.corsepius@rtems.org>
* posix/src/fork.c: Include <unistd.h> for "fork" prototype.
<font color='#006600'>diff -u rtems/cpukit/score/Makefile.am:1.112 rtems/cpukit/score/Makefile.am:1.113
--- rtems/cpukit/score/Makefile.am:1.112 Tue Dec 6 08:23:26 2011
+++ rtems/cpukit/score/Makefile.am Mon Dec 12 09:17:33 2011
</font><font color='#997700'>@@ -329,7 +329,7 @@
</font> libscore_a_SOURCES += src/apiext.c src/chain.c src/chainappend.c \
src/chainextract.c src/chainget.c src/chaininsert.c \
src/chainappendempty.c src/chainprependempty.c src/chaingetempty.c \
<font color='#880000'>- src/interr.c src/isr.c src/wkspace.c
</font><font color='#000088'>+ src/interr.c src/isr.c src/wkspace.c src/wkstringduplicate.c
</font>
EXTRA_DIST = src/Unlimited.txt
<font color='#006600'>diff -u rtems/cpukit/score/include/rtems/score/wkspace.h:1.33 rtems/cpukit/score/include/rtems/score/wkspace.h:1.34
--- rtems/cpukit/score/include/rtems/score/wkspace.h:1.33 Fri Jun 17 10:40:09 2011
+++ rtems/cpukit/score/include/rtems/score/wkspace.h Mon Dec 12 09:17:33 2011
</font><font color='#997700'>@@ -99,6 +99,23 @@
</font> size_t size
);
<font color='#000088'>+/**
+ * @brief Duplicates the @a string with memory from the Workspace.
+ *
+ * If the @a string length exceeds @a maxlen, then the additional characters
+ * will be discarded.
+ *
+ * @param[in] string Pointer to zero terminated string.
+ * @param[in] maxlen Maximum length of the duplicated string.
+ *
+ * @return NULL Not enough memory.
+ * @return other Duplicated string.
+ */
+char *_Workspace_String_duplicate(
+ const char *string,
+ size_t maxlen
+);
+
</font> #ifndef __RTEMS_APPLICATION__
#include <rtems/score/wkspace.inl>
#endif
<font color='#006600'>diff -u /dev/null rtems/cpukit/score/src/wkstringduplicate.c:1.1
--- /dev/null Mon Dec 12 09:30:17 2011
+++ rtems/cpukit/score/src/wkstringduplicate.c Mon Dec 12 09:17:33 2011
</font><font color='#997700'>@@ -0,0 +1,39 @@
</font><font color='#000088'>+/*
+ * Copyright (c) 2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <rtems/score/wkspace.h>
+
+#include <string.h>
+
+char *_Workspace_String_duplicate(
+ const char *string,
+ size_t maxlen
+)
+{
+ size_t n = strnlen(string, maxlen);
+ char *dup = _Workspace_Allocate(n + 1);
+
+ if (dup != NULL) {
+ dup [n] = '\0';
+ memcpy(dup, string, n);
+ }
+
+ return dup;
+}
</font></pre>
<p> </p>
<a name='cs2'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
<font color='#bb2222'><strong>sh</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-12-12 Sebastian Huber <sebastian.huber@embedded-brains.de>
* spwkspace/init.c: Test _Workspace_String_duplicate().
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/ChangeLog.diff?r1=text&tr1=1.501&r2=text&tr2=1.502&diff_format=h">M</a></td><td width='1%'>1.502</td><td width='100%'>testsuites/sptests/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/testsuites/sptests/spwkspace/init.c.diff?r1=text&tr1=1.6&r2=text&tr2=1.7&diff_format=h">M</a></td><td width='1%'>1.7</td><td width='100%'>testsuites/sptests/spwkspace/init.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/testsuites/sptests/ChangeLog:1.501 rtems/testsuites/sptests/ChangeLog:1.502
--- rtems/testsuites/sptests/ChangeLog:1.501 Thu Dec 8 15:38:35 2011
+++ rtems/testsuites/sptests/ChangeLog Mon Dec 12 09:18:18 2011
</font><font color='#997700'>@@ -1,3 +1,7 @@
</font><font color='#000088'>+2011-12-12 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * spwkspace/init.c: Test _Workspace_String_duplicate().
+
</font> 2011-12-08 Joel Sherrill <joel.sherrill@oarcorp.com>
PR 1589/build
<font color='#006600'>diff -u rtems/testsuites/sptests/spwkspace/init.c:1.6 rtems/testsuites/sptests/spwkspace/init.c:1.7
--- rtems/testsuites/sptests/spwkspace/init.c:1.6 Wed Mar 9 14:11:55 2011
+++ rtems/testsuites/sptests/spwkspace/init.c Mon Dec 12 09:18:18 2011
</font><font color='#997700'>@@ -17,6 +17,41 @@
</font>
#include <tmacros.h>
<font color='#000088'>+#include <string.h>
+
+#include <rtems/score/wkspace.h>
+
+static void test_workspace_string_duplicate(void)
+{
+ char a [] = "abcd";
+ char b [] = "abc";
+ char c [] = "ab";
+ char d [] = "a";
+ char e [] = "";
+ size_t maxlen = 3;
+ char *dup_a = _Workspace_String_duplicate( a, maxlen );
+ char *dup_b = _Workspace_String_duplicate( b, maxlen );
+ char *dup_c = _Workspace_String_duplicate( c, maxlen );
+ char *dup_d = _Workspace_String_duplicate( d, maxlen );
+ char *dup_e = _Workspace_String_duplicate( e, maxlen );
+
+ rtems_test_assert( dup_a != NULL );
+ rtems_test_assert( dup_b != NULL );
+ rtems_test_assert( dup_c != NULL );
+ rtems_test_assert( dup_d != NULL );
+ rtems_test_assert( dup_e != NULL );
+ rtems_test_assert( strcmp( dup_a, b ) == 0 );
+ rtems_test_assert( strcmp( dup_b, b ) == 0 );
+ rtems_test_assert( strcmp( dup_c, c ) == 0 );
+ rtems_test_assert( strcmp( dup_d, d ) == 0 );
+ rtems_test_assert( strcmp( dup_e, e ) == 0 );
+
+ _Workspace_Free( dup_a );
+ _Workspace_Free( dup_b );
+ _Workspace_Free( dup_c );
+ _Workspace_Free( dup_d );
+ _Workspace_Free( dup_e );
+}
</font>
rtems_task Init(
rtems_task_argument argument
<font color='#997700'>@@ -61,6 +96,9 @@
</font> retbool = rtems_workspace_free( p1 );
rtems_test_assert( retbool == true );
<font color='#000088'>+ puts( "_Workspace_String_duplicate - samples" );
+ test_workspace_string_duplicate();
+
</font> puts( "*** END OF TEST WORKSPACE CLASSIC API ***" );
rtems_test_exit( 0 );
}
</pre>
<p> </p>
<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>