Author: petdance
Date: Mon Jun 11 19:26:34 2007
New Revision: 18940
Modified:
trunk/include/parrot/headers.h
trunk/include/parrot/string_funcs.h
trunk/src/headers.c
trunk/src/string.c
Log:
More NN flagging
Modified: trunk/include/parrot/headers.h
==============================================================================
--- trunk/include/parrot/headers.h (original)
+++ trunk/include/parrot/headers.h Mon Jun 11 19:26:34 2007
@@ -92,10 +92,12 @@
__attribute__nonnull__(1)
__attribute__warn_unused_result__;
-Small_Object_Pool * new_buffer_pool( Interp *interp )
+Small_Object_Pool * new_buffer_pool( Interp *interp /*NN*/ )
+ __attribute__nonnull__(1)
__attribute__warn_unused_result__;
-void * new_bufferlike_header( Interp *interp, size_t size )
+void * new_bufferlike_header( Interp *interp /*NN*/, size_t size )
+ __attribute__nonnull__(1)
__attribute__warn_unused_result__;
Small_Object_Pool * new_bufferlike_pool( Interp *interp /*NN*/,
@@ -119,11 +121,14 @@
__attribute__nonnull__(1)
__attribute__warn_unused_result__;
-void Parrot_destroy_header_pools( Interp *interp );
-int Parrot_forall_header_pools( Interp *interp,
+void Parrot_destroy_header_pools( Interp *interp /*NN*/ )
+ __attribute__nonnull__(1);
+
+int Parrot_forall_header_pools( Interp *interp /*NN*/,
int flag,
void *arg,
pool_iter_fn func /*NN*/ )
+ __attribute__nonnull__(1)
__attribute__nonnull__(4);
void Parrot_initialize_header_pool_names( Interp *interp );
Modified: trunk/include/parrot/string_funcs.h
==============================================================================
--- trunk/include/parrot/string_funcs.h (original)
+++ trunk/include/parrot/string_funcs.h Mon Jun 11 19:26:34 2007
@@ -31,10 +31,11 @@
char base )
__attribute__nonnull__(2);
-PARROT_API STRING * Parrot_make_COW_reference( Interp *interp,
- STRING *s /*NULLOK*/ );
+PARROT_API STRING * Parrot_make_COW_reference( Interp *interp /*NN*/,
+ STRING *s /*NULLOK*/ )
+ __attribute__nonnull__(1);
-PARROT_API STRING* Parrot_reuse_COW_reference( Interp *interp,
+PARROT_API STRING* Parrot_reuse_COW_reference( Interp *interp /*NULLOK*/,
STRING *s /*NULLOK*/,
STRING *d /*NN*/ )
__attribute__nonnull__(3);
@@ -79,30 +80,37 @@
STRING *a /*NULLOK*/,
STRING *b /*NULLOK*/ );
-PARROT_API STRING * string_bitwise_and( Interp *interp,
+PARROT_API STRING * string_bitwise_and( Interp *interp /*NN*/,
STRING *s1 /*NULLOK*/,
STRING *s2 /*NULLOK*/,
- STRING **dest /*NULLOK*/ );
+ STRING **dest /*NULLOK*/ )
+ __attribute__nonnull__(1);
-PARROT_API STRING * string_bitwise_not( Interp *interp,
+PARROT_API STRING * string_bitwise_not( Interp *interp /*NN*/,
STRING *s /*NULLOK*/,
- STRING **dest /*NULLOK*/ );
+ STRING **dest /*NULLOK*/ )
+ __attribute__nonnull__(1);
-PARROT_API STRING * string_bitwise_or( Interp *interp,
+PARROT_API STRING * string_bitwise_or( Interp *interp /*NN*/,
STRING *s1 /*NULLOK*/,
STRING *s2 /*NULLOK*/,
- STRING **dest /*NULLOK*/ );
+ STRING **dest /*NULLOK*/ )
+ __attribute__nonnull__(1);
-PARROT_API STRING * string_bitwise_xor( Interp *interp,
+PARROT_API STRING * string_bitwise_xor( Interp *interp /*NN*/,
STRING *s1 /*NULLOK*/,
STRING *s2 /*NULLOK*/,
- STRING **dest /*NULLOK*/ );
+ STRING **dest /*NULLOK*/ )
+ __attribute__nonnull__(1);
-PARROT_API INTVAL string_bool( Interp *interp, const STRING *s /*NULLOK*/ )
+PARROT_API INTVAL string_bool( Interp *interp /*NN*/,
+ const STRING *s /*NULLOK*/ )
+ __attribute__nonnull__(1)
__attribute__pure__
__attribute__warn_unused_result__;
-PARROT_API UINTVAL string_capacity( Interp *interp, const STRING *s /*NN*/ )
+PARROT_API UINTVAL string_capacity( Interp *interp /*NULLOK*/,
+ const STRING *s /*NN*/ )
__attribute__nonnull__(2)
__attribute__pure__
__attribute__warn_unused_result__;
@@ -130,7 +138,9 @@
PARROT_API STRING * string_copy( Interp *interp, STRING *s /*NULLOK*/ );
PARROT_API void string_cstring_free( char *p /*NULLOK*/ );
-PARROT_API void string_deinit( Parrot_Interp interp );
+PARROT_API void string_deinit( Interp *interp /*NN*/ )
+ __attribute__nonnull__(1);
+
PARROT_API STRING * string_downcase( Interp *interp,
const STRING *s /*NULLOK*/ );
@@ -179,7 +189,9 @@
UINTVAL idx )
__attribute__nonnull__(2);
-PARROT_API void string_init( Parrot_Interp interp );
+PARROT_API void string_init( Interp *interp /*NN*/ )
+ __attribute__nonnull__(1);
+
PARROT_API STRING* string_join( Interp *interp,
STRING *j /*NULLOK*/,
PMC *ar );
@@ -219,15 +231,17 @@
... )
__attribute__nonnull__(4);
-PARROT_API INTVAL string_ord( Interp *interp,
+PARROT_API INTVAL string_ord( Interp *interp /*NN*/,
const STRING *s /*NULLOK*/,
- INTVAL idx );
+ INTVAL idx )
+ __attribute__nonnull__(1);
PARROT_API void string_pin( Interp *interp, STRING *s /*NN*/ )
__attribute__nonnull__(2);
-PARROT_API const char* string_primary_encoding_for_representation( Interp
*interp,
- parrot_string_representation_t representation );
+PARROT_API const char* string_primary_encoding_for_representation( Interp
*interp /*NN*/,
+ parrot_string_representation_t representation )
+ __attribute__nonnull__(1);
PARROT_API STRING* string_printf( Interp *interp,
const char *format /*NN*/,
@@ -248,16 +262,18 @@
STRING **d /*NULLOK*/ )
__attribute__nonnull__(2);
-PARROT_API STRING * string_replace( Interp *interp,
+PARROT_API STRING * string_replace( Interp *interp /*NN*/,
STRING *src /*NULLOK*/,
INTVAL offset,
INTVAL length,
STRING *rep /*NULLOK*/,
- STRING **d /*NULLOK*/ );
+ STRING **d /*NULLOK*/ )
+ __attribute__nonnull__(1);
-PARROT_API STRING * string_set( Interp *interp,
+PARROT_API STRING * string_set( Interp *interp /*NN*/,
STRING *dest /*NULLOK*/,
- STRING *src /*NULLOK*/ );
+ STRING *src /*NULLOK*/ )
+ __attribute__nonnull__(1);
PARROT_API PMC* string_split( Interp *interp,
STRING *delim /*NN*/,
@@ -272,12 +288,13 @@
__attribute__nonnull__(2)
__attribute__nonnull__(3);
-PARROT_API STRING * string_substr( Interp *interp,
+PARROT_API STRING * string_substr( Interp *interp /*NN*/,
STRING *src /*NN*/,
INTVAL offset,
INTVAL length,
STRING **d /*NULLOK*/,
int replace_dest )
+ __attribute__nonnull__(1)
__attribute__nonnull__(2);
PARROT_API STRING * string_titlecase( Interp *interp,
Modified: trunk/src/headers.c
==============================================================================
--- trunk/src/headers.c (original)
+++ trunk/src/headers.c Mon Jun 11 19:26:34 2007
@@ -113,7 +113,7 @@
*/
Small_Object_Pool *
-new_buffer_pool(Interp *interp)
+new_buffer_pool(Interp *interp /*NN*/)
/* WARN_UNUSED */
{
return make_bufferlike_pool(interp, sizeof (Buffer));
@@ -353,7 +353,7 @@
*/
void *
-new_bufferlike_header(Interp *interp, size_t size)
+new_bufferlike_header(Interp *interp /*NN*/, size_t size)
/* WARN_UNUSED */
{
Small_Object_Pool * const pool = get_bufferlike_pool(interp, size);
@@ -453,6 +453,7 @@
int
is_buffer_ptr(Interp *interp /*NN*/, void *ptr) /* XXX Const this */
+ /* WARN_UNUSED */
{
UINTVAL i;
Arenas * const arena_base = interp->arena_base;
@@ -568,7 +569,7 @@
*/
int
-Parrot_forall_header_pools(Interp *interp, int flag, void *arg, pool_iter_fn
func /*NN*/)
+Parrot_forall_header_pools(Interp *interp /*NN*/, int flag, void *arg,
pool_iter_fn func /*NN*/)
{
Arenas * const arena_base = interp->arena_base;
int i;
@@ -626,7 +627,7 @@
}
static int
-sweep_cb_buf(Interp *interp, Small_Object_Pool *pool, int flag,
+sweep_cb_buf(Interp *interp /*NN*/, Small_Object_Pool *pool, int flag,
void *arg)
{
#ifdef GC_IS_MALLOC
@@ -647,7 +648,7 @@
}
static int
-sweep_cb_pmc(Interp *interp, Small_Object_Pool *pool, int flag,
+sweep_cb_pmc(Interp *interp /*NN*/, Small_Object_Pool *pool /*NN*/, int flag,
void *arg)
{
Parrot_dod_sweep(interp, pool);
@@ -656,7 +657,7 @@
}
void
-Parrot_destroy_header_pools(Interp *interp)
+Parrot_destroy_header_pools(Interp *interp /*NN*/)
{
INTVAL pass, start;
@@ -682,7 +683,9 @@
mem_internal_free(interp->arena_base->sized_header_pools);
}
-static void fix_pmc_syncs(Interp *dest_interp, Small_Object_Pool *pool) {
+static void
+fix_pmc_syncs(Interp *dest_interp, Small_Object_Pool *pool /*NN*/)
+{
/* XXX largely copied from dod_sweep */
Small_Object_Arena *cur_arena;
const UINTVAL object_size = pool->object_size;
Modified: trunk/src/string.c
==============================================================================
--- trunk/src/string.c (original)
+++ trunk/src/string.c Mon Jun 11 19:26:34 2007
@@ -120,7 +120,7 @@
PARROT_API
STRING *
-Parrot_make_COW_reference(Interp *interp, STRING *s /*NULLOK*/)
+Parrot_make_COW_reference(Interp *interp /*NN*/, STRING *s /*NULLOK*/)
{
STRING *d;
if (s == NULL)
@@ -169,7 +169,7 @@
PARROT_API
STRING*
-Parrot_reuse_COW_reference(Interp *interp, STRING *s /*NULLOK*/, STRING *d
/*NN*/)
+Parrot_reuse_COW_reference(Interp *interp /*NULLOK*/, STRING *s /*NULLOK*/,
STRING *d /*NN*/)
{
if (s == NULL) {
return NULL;
@@ -199,7 +199,7 @@
PARROT_API
STRING *
-string_set(Interp *interp, STRING *dest /*NULLOK*/, STRING *src /*NULLOK*/)
+string_set(Interp *interp /*NN*/, STRING *dest /*NULLOK*/, STRING *src
/*NULLOK*/)
{
if (!src)
return NULL;
@@ -234,7 +234,7 @@
PARROT_API
void
-string_init(Parrot_Interp interp)
+string_init(Interp *interp /*NN*/)
{
size_t i;
@@ -277,7 +277,7 @@
PARROT_API
void
-string_deinit(Parrot_Interp interp)
+string_deinit(Interp *interp /*NN*/)
{
/* all are shared between interpreters */
if (!interp->parent_interpreter) {
@@ -297,7 +297,7 @@
PARROT_API
UINTVAL
-string_capacity(Interp *interp, const STRING *s /*NN*/)
+string_capacity(Interp *interp /*NULLOK*/, const STRING *s /*NN*/)
/*PURE,WARN_UNUSED*/
{
return ((ptrcast_t)PObj_bufstart(s) + PObj_buflen(s) -
@@ -530,7 +530,7 @@
PARROT_API
const char*
-string_primary_encoding_for_representation(Interp *interp,
+string_primary_encoding_for_representation(Interp *interp /*NN*/,
parrot_string_representation_t representation)
{
switch (representation) {
@@ -764,7 +764,7 @@
PARROT_API
INTVAL
-string_ord(Interp *interp, const STRING *s /*NULLOK*/, INTVAL idx)
+string_ord(Interp *interp /*NN*/, const STRING *s /*NULLOK*/, INTVAL idx)
{
const UINTVAL len = string_length(interp, s);
@@ -969,7 +969,7 @@
PARROT_API
STRING *
-string_substr(Interp *interp, STRING *src /*NN*/, INTVAL offset, INTVAL length,
+string_substr(Interp *interp /*NN*/, STRING *src /*NN*/, INTVAL offset, INTVAL
length,
STRING **d /*NULLOK*/, int replace_dest)
{
STRING *dest;
@@ -1044,7 +1044,7 @@
PARROT_API
STRING *
-string_replace(Interp *interp, STRING *src /*NULLOK*/,
+string_replace(Interp *interp /*NN*/, STRING *src /*NULLOK*/,
INTVAL offset, INTVAL length, STRING *rep /*NULLOK*/, STRING **d
/*NULLOK*/)
{
STRING *dest = NULL;
@@ -1348,7 +1348,7 @@
PARROT_API
STRING *
-string_bitwise_and(Interp *interp, STRING *s1 /*NULLOK*/,
+string_bitwise_and(Interp *interp /*NN*/, STRING *s1 /*NULLOK*/,
STRING *s2 /*NULLOK*/, STRING **dest /*NULLOK*/)
{
STRING *res = NULL;
@@ -1452,7 +1452,7 @@
PARROT_API
STRING *
-string_bitwise_or(Interp *interp, STRING *s1 /*NULLOK*/,
+string_bitwise_or(Interp *interp /*NN*/, STRING *s1 /*NULLOK*/,
STRING *s2 /*NULLOK*/, STRING **dest /*NULLOK*/)
{
STRING *res;
@@ -1523,7 +1523,7 @@
PARROT_API
STRING *
-string_bitwise_xor(Interp *interp, STRING *s1 /*NULLOK*/,
+string_bitwise_xor(Interp *interp /*NN*/, STRING *s1 /*NULLOK*/,
STRING *s2 /*NULLOK*/, STRING **dest /*NULLOK*/)
{
STRING *res;
@@ -1605,7 +1605,7 @@
PARROT_API
STRING *
-string_bitwise_not(Interp *interp, STRING *s /*NULLOK*/, STRING **dest
/*NULLOK*/)
+string_bitwise_not(Interp *interp /*NN*/, STRING *s /*NULLOK*/, STRING **dest
/*NULLOK*/)
{
STRING *res;
size_t len;
@@ -1664,7 +1664,7 @@
PARROT_API
INTVAL
-string_bool(Interp *interp, const STRING *s /*NULLOK*/)
+string_bool(Interp *interp /*NN*/, const STRING *s /*NULLOK*/)
/* PURE, WARN_UNUSED */
{
const INTVAL len = string_length(interp, s);
@@ -1673,7 +1673,6 @@
return 0;
if (len == 1) {
-
const UINTVAL c = string_index(interp, s, 0);
/* relying on character literals being interpreted as ASCII--may