Revision cb201402

View differences:

include/chunkbuffer.h
88 88
 */
89 89
void cb_destroy(struct chunk_buffer *cb);
90 90

  
91

  
92
/*
93
 * HA Functions
94
 */
95
const struct chunk *cb_get_chunk(const struct chunk_buffer *cb, int id);
96

  
91 97
#endif	/* CHUNKBUFFER_H */
som/ChunkBuffer/Makefile
8 8

  
9 9
CPPFLAGS = -I$(BASE)/include
10 10

  
11
OBJS = buffer.o config.o
11
OBJS = buffer.o config.o buffer-ha.o
12 12

  
13 13
all: libcb.a
14 14

  
som/ChunkBuffer/buffer-ha.c
1
#include <stdlib.h>
2
#include <stdint.h>
3
#include <string.h>
4

  
5
#include "chunk.h"
6
#include "chunkbuffer.h"
7

  
8
const struct chunk *cb_get_chunk(const struct chunk_buffer *cb, int id)
9
{
10
  int i, n;
11
  const struct chunk *buffer;
12

  
13
  buffer = cb_get_chunks(cb, &n);
14
  if (buffer == NULL) {
15
    return NULL;
16
  }
17

  
18
  for (i = 0; i < n; i++) {
19
    if (buffer[i].id == id) {
20
      return &buffer[i];
21
    }
22
  }
23

  
24
  return NULL;
25
}

Also available in: Unified diff