Kaynağa Gözat

Better cstring manipulation

master
Ludovic 'Archivist' Lagouardette 5 yıl önce
ebeveyn
işleme
b25ac43bd1
2 değiştirilmiş dosya ile 12 ekleme ve 2 silme
  1. +10
    -0
      include/rigid_paradise/string.h
  2. +2
    -2
      src/yes/yes.cpp

+ 10
- 0
include/rigid_paradise/string.h Dosyayı Görüntüle

@ -0,0 +1,10 @@
#pragma once
#include <stddef.h>
namespace cstring{
constexpr size_t strlen( const char* s ) noexcept
{
return *s ? 1 + strlen(s + 1) : 0;
}
}

+ 2
- 2
src/yes/yes.cpp Dosyayı Görüntüle

@ -3,7 +3,7 @@
#include <string>
#include <sstream>
#include <rigid_paradise/systems/stdio.h>
#include <string.h>
#include <rigid_paradise/string.h>
#ifndef EXIT_FAILURE
#define EXIT_FAILURE -1
@ -17,7 +17,7 @@ usage: yes [STRING]*\n\
yes --help\n\
yes --version\n\
Display this text.\n";
const size_t help_len = strlen(help);
const size_t help_len = cstring::strlen(help);
int main(int argc, char** argv)
{

Yükleniyor…
İptal
Kaydet