A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

C - Stikked
From Eratic Mousedeer, 13 Years ago, written in C.
This paste is a reply to Codemirror test from Gracious Treeshrew - view diff
Embed
  1. /* C demo code */
  2.  
  3. #include <zmq.h>
  4. #include <pthread.h>
  5. #include <semaphore.h>
  6. #include <time.h>
  7. #include <stdio.h>
  8. #include <fcntl.h>
  9. #include <malloc.h>
  10.  
  11. typedef struct {
  12.   void* arg_socket;
  13.   zmq_msg_t* arg_msg;
  14.   char* arg_string;
  15.   unsigned long arg_len;
  16.   int arg_int, arg_command;
  17.  
  18.   int signal_fd;
  19.   int pad;
  20.   void* context;
  21.   sem_t sem;
  22. } acl_zmq_context;
  23.  
  24. #define p(X) (context->arg_##X)
  25.  
  26. void* zmq_thread(void* context_pointer) {
  27.   acl_zmq_context* context = (acl_zmq_context*)context_pointer;
  28.   char ok = 'K', err = 'X';
  29.   int res;
  30.  
  31.   while (1) {
  32.     while ((res = sem_wait(&context->sem)) == EINTR);
  33.     if (res) {write(context->signal_fd, &err, 1); goto cleanup;}
  34.     switch(p(command)) {
  35.     case 0: goto cleanup;
  36.     case 1: p(socket) = zmq_socket(context->context, p(int)); break;
  37.     case 2: p(int) = zmq_close(p(socket)); break;
  38.     case 3: p(int) = zmq_bind(p(socket), p(string)); break;
  39.     case 4: p(int) = zmq_connect(p(socket), p(string)); break;
  40.     case 5: p(int) = zmq_getsockopt(p(socket), p(int), (void*)p(string), &p(len)); break;
  41.     case 6: p(int) = zmq_setsockopt(p(socket), p(int), (void*)p(string), p(len)); break;
  42.     case 7: p(int) = zmq_send(p(socket), p(msg), p(int)); break;
  43.     case 8: p(int) = zmq_recv(p(socket), p(msg), p(int)); break;
  44.     case 9: p(int) = zmq_poll(p(socket), p(int), p(len)); break;
  45.     }
  46.     p(command) = errno;
  47.     write(context->signal_fd, &ok, 1);
  48.   }
  49.  cleanup:
  50.   close(context->signal_fd);
  51.   free(context_pointer);
  52.   return 0;
  53. }
  54.  
  55. void* zmq_thread_init(void* zmq_context, int signal_fd) {
  56.   acl_zmq_context* context = malloc(sizeof(acl_zmq_context));
  57.   pthread_t thread;
  58.  
  59.   context->context = zmq_context;
  60.   context->signal_fd = signal_fd;
  61.   sem_init(&context->sem, 1, 0);
  62.   pthread_create(&thread, 0, &zmq_thread, context);
  63.   pthread_detach(thread);
  64.   return context;
  65. }
  66.