Skip to content
Snippets Groups Projects
Select Git revision
  • pu
  • passt default
  • master
  • todo
  • next
  • maint
  • v2.8.0-rc1
  • v2.8.0-rc0
  • v2.7.2
  • v2.7.1
  • v2.7.0
  • v2.6.5
  • v2.7.0-rc3
  • v2.7.0-rc2
  • v2.7.0-rc1
  • v2.7.0-rc0
  • v2.6.4
  • v2.6.3
  • v2.6.2
  • v2.6.1
  • v2.3.10
  • v2.5.4
  • v2.4.10
  • v2.6.0
  • v2.6.0-rc3
  • v2.5.3
26 results

argv-array.h

Blame
    • Jeff King's avatar
      b992657e
      argv-array: add detach function · b992657e
      Jeff King authored
      
      The usual pattern for an argv array is to initialize it,
      push in some strings, and then clear it when done. Very
      occasionally, though, we must do other exotic things with
      the memory, like freeing the list but keeping the strings.
      Let's provide a detach function so that callers can make use
      of our API to build up the array, and then take ownership of
      it.
      
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      b992657e
      History
      argv-array: add detach function
      Jeff King authored
      
      The usual pattern for an argv array is to initialize it,
      push in some strings, and then clear it when done. Very
      occasionally, though, we must do other exotic things with
      the memory, like freeing the list but keeping the strings.
      Let's provide a detach function so that callers can make use
      of our API to build up the array, and then take ownership of
      it.
      
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    emper-server-slides.cpp 181 B
    void server(int listen_sock) {
    	auto handler = [](int fd) {
    		auto in = read(fd);
    		auto out = process(in);
    		write(fd, out);
    		close(fd);
    	}
    	tcp_listener(listen_sock, handler);
    }