Rev 4243 | Rev 4708 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4243 | Rev 4271 | ||
---|---|---|---|
Line 69... | Line 69... | ||
69 | memcpy( new->value, string, new->length ); |
69 | memcpy( new->value, string, new->length ); |
70 | new->value[ new->length ] = '\0'; |
70 | new->value[ new->length ] = '\0'; |
71 | return new; |
71 | return new; |
72 | } |
72 | } |
73 | 73 | ||
- | 74 | measured_string_ref measured_string_copy( measured_string_ref source ){ |
|
- | 75 | measured_string_ref new; |
|
- | 76 | ||
- | 77 | if( ! source ) return NULL; |
|
- | 78 | new = ( measured_string_ref ) malloc( sizeof( measured_string_t )); |
|
- | 79 | if( new ){ |
|
- | 80 | new->value = ( char * ) malloc( source->length + 1 ); |
|
- | 81 | if( new->value ){ |
|
- | 82 | new->length = source->length; |
|
- | 83 | memcpy( new->value, source->value, new->length ); |
|
- | 84 | new->value[ new->length ] = '\0'; |
|
- | 85 | return new; |
|
- | 86 | }else{ |
|
- | 87 | free( new ); |
|
- | 88 | } |
|
- | 89 | } |
|
- | 90 | return NULL; |
|
- | 91 | } |
|
- | 92 | ||
74 | int measured_strings_receive( measured_string_ref * strings, char ** data, size_t count ){ |
93 | int measured_strings_receive( measured_string_ref * strings, char ** data, size_t count ){ |
75 | ERROR_DECLARE; |
94 | ERROR_DECLARE; |
76 | 95 | ||
77 | size_t * lengths; |
96 | size_t * lengths; |
78 | size_t index; |
97 | size_t index; |