- changed use of bzero (deprecated) to memset (thanks to Spen for pointing this out)

- changed fallback implementation of strndup to something that works on all systems (thanks to Spen for this patch)


git-svn-id: svn://svn.berlios.de/openocd/trunk@75 b42882b7-edfa-0310-969c-e2dbd0fdcd60
__archive__
drath 2006-06-25 20:44:25 +00:00
parent db0264db2a
commit d4d36b0a9a
3 changed files with 13 additions and 9 deletions

View File

@ -18,7 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#define OPENOCD_VERSION "Open On-Chip Debugger (2006-06-25 13:15 CEST)" #define OPENOCD_VERSION "Open On-Chip Debugger (2006-06-25 22:45 CEST)"
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>

View File

@ -32,14 +32,18 @@
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
// -ino: 060521-1116
#ifndef HAVE_STRNDUP #ifndef HAVE_STRNDUP
#include <stdio.h> #include <stdio.h>
char * strndup(char * str, int n) { char* strndup(const char *s, size_t n)
unsigned char * tmp = malloc((size_t)n+1); {
if (! tmp) perror("gdb_server malloc failed"); size_t len = strnlen (s, n);
if (strlcpy(tmp, str, n) > n) perror("gdb_server strndup: too long"); char *new = (char *) malloc (len + 1);
return tmp;
if (new == NULL)
return NULL;
new[len] = '\0';
return (char *) memcpy (new, s, len);
} }
#endif #endif

View File

@ -21,7 +21,7 @@
#include "log.h" #include "log.h"
#include <strings.h> #include <string.h>
/* textual represenation of the condition field */ /* textual represenation of the condition field */
/* ALways (default) is ommitted (empty string) */ /* ALways (default) is ommitted (empty string) */
@ -1158,7 +1158,7 @@ int evaluate_data_proc(u32 opcode, u32 address, arm_instruction_t *instruction)
int evaluate_opcode(u32 opcode, u32 address, arm_instruction_t *instruction) int evaluate_opcode(u32 opcode, u32 address, arm_instruction_t *instruction)
{ {
/* clear fields, to avoid confusion */ /* clear fields, to avoid confusion */
bzero(instruction, sizeof(arm_instruction_t)); memset(instruction, 0, sizeof(arm_instruction_t));
instruction->opcode = opcode; instruction->opcode = opcode;
/* catch opcodes with condition field [31:28] = b1111 */ /* catch opcodes with condition field [31:28] = b1111 */