From 59edfdb787c06b8af4de8b8f1517d739ac31c626 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Sun, 3 Nov 2013 14:05:23 +0100 Subject: [PATCH] Remove . --- libc/Makefile | 1 - libc/include/readparamstring.h | 36 --------------- libc/readparamstring.cpp | 82 ---------------------------------- utils/chvideomode.cpp | 1 - 4 files changed, 120 deletions(-) delete mode 100644 libc/include/readparamstring.h delete mode 100644 libc/readparamstring.cpp diff --git a/libc/Makefile b/libc/Makefile index 080886cb..d2c8bbdf 100644 --- a/libc/Makefile +++ b/libc/Makefile @@ -77,7 +77,6 @@ memcpy.o \ memmove.o \ memset.o \ op-new.o \ -readparamstring.o \ rewind.o \ sort.o \ sprint.o \ diff --git a/libc/include/readparamstring.h b/libc/include/readparamstring.h deleted file mode 100644 index 7b1c9e46..00000000 --- a/libc/include/readparamstring.h +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - - Copyright(C) Jonas 'Sortie' Termansen 2012. - - This file is part of the Sortix C Library. - - The Sortix C Library is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - The Sortix C Library 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 Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with the Sortix C Library. If not, see . - - readparamstring.h - A kinda dirty hack to ease transition to the /dev/video API. - -*******************************************************************************/ - -#ifndef _READPARAMSTRING_H -#define _READPARAMSTRING_H 1 - -#include - -__BEGIN_DECLS - -bool ReadParamString(const char* str, ...); - -__END_DECLS - -#endif diff --git a/libc/readparamstring.cpp b/libc/readparamstring.cpp deleted file mode 100644 index 7cb2cd40..00000000 --- a/libc/readparamstring.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - - Copyright(C) Jonas 'Sortie' Termansen 2012. - - This file is part of the Sortix C Library. - - The Sortix C Library is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or (at your - option) any later version. - - The Sortix C Library 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 Lesser General Public - License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with the Sortix C Library. If not, see . - - readparamstring.cpp - A kinda dirty hack to ease transition to the /dev/video API. - -*******************************************************************************/ - -#include -#include -#include -#include - -static char* Substring(const char* src, size_t offset, size_t length) -{ - char* dest = new char[length + 1]; - if ( !dest ) { return NULL; } - memcpy(dest, src + offset, length * sizeof(char)); - dest[length] = 0; - return dest; -} - -extern "C" bool ReadParamString(const char* str, ...) -{ - if ( strchr(str, '\n') ) { errno = EINVAL; } - const char* keyname; - va_list args; - while ( *str ) - { - size_t varlen = strcspn(str, ","); - if ( !varlen ) { str++; continue; } - size_t namelen = strcspn(str, "="); - if ( !namelen ) { errno = EINVAL; goto cleanup; } - if ( !str[namelen] ) { errno = EINVAL; goto cleanup; } - if ( varlen < namelen ) { errno = EINVAL; goto cleanup; } - size_t valuelen = varlen - 1 /*=*/ - namelen; - char* name = Substring(str, 0, namelen); - if ( !name ) { goto cleanup; } - char* value = Substring(str, namelen+1, valuelen); - if ( !value ) { delete[] name; goto cleanup; } - va_start(args, str); - while ( (keyname = va_arg(args, const char*)) ) - { - char** nameptr = va_arg(args, char**); - if ( strcmp(keyname, name) ) { continue; } - *nameptr = value; - break; - } - va_end(args); - if ( !keyname ) { delete[] value; } - delete[] name; - str += varlen; - str += strspn(str, ","); - } - return true; - -cleanup: - va_start(args, str); - while ( (keyname = va_arg(args, const char*)) ) - { - char** nameptr = va_arg(args, char**); - delete[] *nameptr; *nameptr = NULL; - } - va_end(args); - return false; -} diff --git a/utils/chvideomode.cpp b/utils/chvideomode.cpp index 3e5af620..4344c10d 100644 --- a/utils/chvideomode.cpp +++ b/utils/chvideomode.cpp @@ -36,7 +36,6 @@ #include #include #include -#include // TODO: Provide this using asprintf or somewhere sane in user-space. char* Combine(size_t NumParameters, ...)