]> granicus.if.org Git - yasm/commitdiff
Initial check-in of utility functions.
authorPeter Johnson <peter@tortall.net>
Wed, 13 Jun 2001 05:24:50 +0000 (05:24 -0000)
committerPeter Johnson <peter@tortall.net>
Wed, 13 Jun 2001 05:24:50 +0000 (05:24 -0000)
svn path=/trunk/yasm/; revision=49

include/util.h [new file with mode: 0644]
libyasm/util.h [new file with mode: 0644]
src/util.c [new file with mode: 0644]
src/util.h [new file with mode: 0644]
util.h [new file with mode: 0644]

diff --git a/include/util.h b/include/util.h
new file mode 100644 (file)
index 0000000..33377ab
--- /dev/null
@@ -0,0 +1,27 @@
+/* $Id: util.h,v 1.1 2001/06/13 05:24:50 peter Exp $
+ * Various utility functions for ANSI C compatibility header file
+ *
+ *  Copyright (C) 2001  Peter Johnson
+ *
+ *  This file is part of YASM.
+ *
+ *  YASM 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.
+ *
+ *  YASM 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef _UTIL_H_
+#define _UTIL_H_
+
+char *y_strdup(char *str);
+
+#endif
diff --git a/libyasm/util.h b/libyasm/util.h
new file mode 100644 (file)
index 0000000..33377ab
--- /dev/null
@@ -0,0 +1,27 @@
+/* $Id: util.h,v 1.1 2001/06/13 05:24:50 peter Exp $
+ * Various utility functions for ANSI C compatibility header file
+ *
+ *  Copyright (C) 2001  Peter Johnson
+ *
+ *  This file is part of YASM.
+ *
+ *  YASM 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.
+ *
+ *  YASM 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef _UTIL_H_
+#define _UTIL_H_
+
+char *y_strdup(char *str);
+
+#endif
diff --git a/src/util.c b/src/util.c
new file mode 100644 (file)
index 0000000..52496cc
--- /dev/null
@@ -0,0 +1,36 @@
+/* $Id: util.c,v 1.1 2001/06/13 05:24:50 peter Exp $
+ * Various utility functions for ANSI C compatibility
+ *
+ *  Copyright (C) 2001  Peter Johnson
+ *
+ *  This file is part of YASM.
+ *
+ *  YASM 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.
+ *
+ *  YASM 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#include <stdlib.h>
+#include <string.h>
+#include "util.h"
+
+char *y_strdup(char *str)
+{
+    size_t len;
+    char *copy;
+
+    len = strlen(str) + 1;
+    if((copy = malloc(len)) == NULL)
+       return (char *)NULL;
+    memcpy(copy, str, len);
+    return copy;
+}
diff --git a/src/util.h b/src/util.h
new file mode 100644 (file)
index 0000000..33377ab
--- /dev/null
@@ -0,0 +1,27 @@
+/* $Id: util.h,v 1.1 2001/06/13 05:24:50 peter Exp $
+ * Various utility functions for ANSI C compatibility header file
+ *
+ *  Copyright (C) 2001  Peter Johnson
+ *
+ *  This file is part of YASM.
+ *
+ *  YASM 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.
+ *
+ *  YASM 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef _UTIL_H_
+#define _UTIL_H_
+
+char *y_strdup(char *str);
+
+#endif
diff --git a/util.h b/util.h
new file mode 100644 (file)
index 0000000..33377ab
--- /dev/null
+++ b/util.h
@@ -0,0 +1,27 @@
+/* $Id: util.h,v 1.1 2001/06/13 05:24:50 peter Exp $
+ * Various utility functions for ANSI C compatibility header file
+ *
+ *  Copyright (C) 2001  Peter Johnson
+ *
+ *  This file is part of YASM.
+ *
+ *  YASM 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.
+ *
+ *  YASM 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef _UTIL_H_
+#define _UTIL_H_
+
+char *y_strdup(char *str);
+
+#endif